<%@page import="com.sq.partner.manager.util.StrUtil"%>
<%@page import="java.sql.Struct"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<% String path=request.getContextPath(); String basePath=request.getScheme()+ "://" + request.getServerName() + ":" + request.getServerPort() + path+ "/"; %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head>
<base href="<%=basePath%>">
<title>投保方案新增</title>
<%@ include file="/WEB-INF/jsp/common/common.jsp" %>
<style type="text/css">
.input_text{width:180px;}
.select_1{width:180px;}
#agentType3Table{
	 margin: auto;
}
#agentType4Table{
	 margin: auto;
}
#agentType3Table td{
	border: 1px solid #bbcddb;
	height:15px; 
	line-height:15px;
}
#agentType4Table td{
	border: 1px solid #bbcddb;
	height:15px; 
	line-height:15px;
}
	#agentInfoRela6Table td{
	   text-align: center;
	}
</style>
<script src="js/jquery.validate.js" type="text/javascript" ></script>
<script src="js/jquery.divbox.js" type="text/javascript"></script>
<script src="js/json2.js" type="text/javascript"></script>
	<script src="js/nlifePlanConfig.js" type="text/javascript"></script>

<script type="text/javascript">
//自定义map功能
function Map(){
  this.elements = new Array();
   //获取MAP元素个数
   this.size = function() {
       return this.elements.length;
   };
   //判断MAP是否为空
   this.isEmpty = function() {
       return (this.elements.length < 1);
   };
   //删除MAP所有元素
   this.clear = function() {
       this.elements = new Array();
   };
   //向MAP中增加元素（key, value)
   this.put = function(_key, _value) {
       if(this.containsKey(_key)){
        this.remove(_key);
        this.elements.push( {
           key : _key,
           value : _value
        });
       }else{
        this.elements.push( {
           key : _key,
           value : _value
        });
       }  
   };
   //删除指定KEY的元素，成功返回True，失败返回False
   this.remove = function(_key) {
       var bln = false;
       try {
           for (var i = 0; i < this.elements.length; i++) {
               if (this.elements[i].key == _key) {
                   this.elements.splice(i, 1);
                   return true;
               }
           }
       } catch (e) {
           bln = false;
       }
       return bln;
   };
   //获取指定KEY的元素值VALUE，失败返回NULL
   this.get = function(_key) {
	  
       try {
           for (var i = 0; i < this.elements.length; i++) {
               if (this.elements[i].key == _key) {
                   return this.elements[i].value;
               }
           }
       } catch (e) {
    	  
           return false;
       }
       return false;
   };
   //判断MAP中是否含有指定KEY的元素
   this.containsKey = function(_key) {
       var bln = false;
       try {
           for (var i = 0; i < this.elements.length; i++) {
               if (this.elements[i].key == _key) {
                   bln = true;
               }
           }
       } catch (e) {
           bln = false;
       }
       return bln;
   };
  //获取map的所有values
  this.values = function() {
       var arr = new Array();
       for (var i = 0; i < this.elements.length; i++) {
           arr.push(this.elements[i].value);
       }
       return arr;
   };
  //获取map的所有keys
  this.keys= function() {
       var arr = new Array();
       for (var i = 0; i < this.elements.length; i++) {
           arr.push(this.elements[i].key);
       }
       return arr;
   };
   //获取数组
   this.getArray= function(){
   	var arr = new Array();
   	for (var i = 0; i < this.elements.length; i++) {
           arr.push({
	            key : this.elements[i].key,
	            value : this.elements[i].value
	         });
       }
       return arr;
   };
}
//********************************************	
var emailMap=new Map();
var channelFlag="";
var epolicyType="";
var econfirmType="";
//当“是否发送短信”的值为“是”时，短信模板配置可输入
function changeIsCancelMessage(){
	var isMessage = $.trim($('#isCancelMessage').val());
	if(isMessage =='Y'){
		$('#cancelReceiverDiv').show();
		$('#cancelTemplateTr').show();
		$('#cancelTemplateDiv').show();
		//$('#cancelTemplate').css("background-color","white");
		$('#cancelTemplate').attr("disabled",true).css("background-color","rgb(204, 204, 204)");
	}else{
		$('#cancelReceiverDiv').hide();
		$('#cancelTemplateTr').hide();
		$('#cancelTemplateDiv').hide();
		$('#cancelTemplate').val('');
		$('#isCancelTemplate').val('');
	}
}
//关闭 个人/总对总销售业务信息配置  弹出层
function closeAgentInfoDiv(obj){
	var selectedAgentInfo = $("input[name^=agentInfo]:checked");
	if(selectedAgentInfo.length!=0){
		selectedAgentInfo.each(function(i){
			$(this).prop("checked",false);
		});
	}
	
	map.clear();
	for(i in mapBak.keys()){
		var key = mapBak.keys()[i];
        map.put(key,mapBak.get(key));
    }
	
	$("#confStatus_3").val("");
	$("#userCode").val("");
	$("#userName").val("");
	
	$("#confStatus_4").val("");
	$("#branch").val("");
	$("#branchName").val("");
	
	$("#confStatus_5").val("");
	$("#key1").val("");
	$("#key2").val("");
	$("#key3").val("");
	$("#key4").val("");
	$("#key5").val("");
	
	$("#"+obj).CloseDiv();	
}
//展示选中的承保短信模板内容
function changeIsMessageTemplate(){
	var value = $('#smsTemplate').val();
	if(value ==null || "" == value || "0" == value){
		$('#messageTemplate').val("");
		return false;
	}
	 $.ajax({
		 	url : "<%=path%>/noCarInsure/loadTemplate",
			type : 'POST',
			async : true,
			dataType:'json',
			data:{smsTemplateCode:value},
			success : function(obj) {
				var smsTemplate = obj;
				$('#messageTemplate').val(obj.smsTemplateText);
			}
	});
}
//跟单费用配置选择保存
function saveChosenAgentInfo6(){
	var selectedAgentInfo6 = $("input[name='agentInfo6radioBox']:checked");
	if(selectedAgentInfo6.val()==undefined){
		$.message("error","请选中一项");
		return ;
	}
	var agentNo=selectedAgentInfo6.parent().parent().children("td:eq(1)").html();
	var planNo=$.trim($('#hidepno').val());
	$.openLoading();
	$.ajax({							
		url : "<%=path%>/noCarInsure/saveCoinPlan?"+new Date().getTime(),
		type : 'POST',
		async : true,
		data:{
			agentNo:agentNo,
			planNo:planNo
		},
		dataType:'json',
		success:function(data){
			$.closeLoading();
			if(data.success){
				$.message("success","添加成功");
				closeAgentInfoDiv("agentInfo6Div");
				queryAgentInfoRela6(1);
			}else{
				$.message("error","添加失败请重试");
			}
		}
	});
	
}//跟单费用配置选择保存结束
function queryAgentInfo6(current){
	var agentNo=$('#agentNoSer').val();
	var agentName=$('#agentNameSer').val();
	loadAgentInfo6({current:current,size:10,agentNo:agentNo,agentName:agentName})
}
//加载总对总代理信息
function loadAgentInfo6(param){
	$.openLoading();
	$.ajax({							
		url : "<%=path%>/noCarSaleConfig/querySalePageByCriteria?"+new Date().getTime(),
		type : 'POST',
		async : true,
		data:param,
		dataType:'json',
		success:function(page){
			$.closeLoading();
			if(page.data==null){
				$.message("error","请配置跟单费用配置信息");
				return ;
			}
			var checkboxObj ="<input name='agentInfo6radioBox' type='radio'>";
			var fieldNames ="AGENT_NO,AGENT_NAME";
			var tableContent = creatTable1(fieldNames,page,checkboxObj);
			var tableObj = $("#agentInfo6Table");
			tableObj.find("tbody").remove();
			tableObj.append(tableContent);
			var strPage = creatChannelPage4(param.current,6,page.maxPage,"63");
			var pageDIV = $("#agentInfo6Page");
			pageDIV[0].innerHTML="";
			pageDIV.append(strPage);
			
			$('#agentInfo6Div').OpenDiv();
			
			bindradio();
		}
	});
}
//接口传入方案打开div
function openAgentInfo6Div(current){
	loadAgentInfo6({current:current,size:10})
}
//销售人员信息保存
function  saveSale(){
	var salemap1=new Map();
	var arr1 = new Array(); 
	for (var i = 1; i <= 5; i++) {
		var flag=0;
		var j=0;
		var o=new Object();
		var seqNo=$('#flag'+i).val();
		o.seqNo=seqNo;
		//销售人员类别
		var saletype=$('#saletype'+i).val();
		var saleName=$('#saletype'+i).find("option:selected").text()
		if(saletype!='0'){
			o.saleType=saletype;
			o.saleName=saleName;
			j=j+1;
			flag=flag+1;
		}
		//费用比例
		var saleRate=$('#saleRate'+i).val();
		if($.trim(saleRate)!=''){
			o.agentFee=saleRate;
			j=j+1;
			flag=flag+1;
		}
		//执业证号
		var saleCallNo=$('#saleCallNo'+i).val();
		if($.trim(saleCallNo)!=''){
			o.practiceNo=saleCallNo;
		}
		//人员类别
		var saleMentype=$('#saleMentype'+i).val();
		var saleMenName= $('#saleMentype'+i).find("option:selected").text();
		if(saleMentype!='0'){
			o.personType=saleMentype;
			o.personTypeName=saleMenName;
			flag=flag+1;
			j=j+1;
		}
		//销售人员
		var saleMen=$('#saleMen'+i).val();
		if($.trim(saleMen)!=''){
			o.salePerson=saleMen;
			flag=flag+1;
		}
		//业务员
		var empNo=$('#empNo'+i).val();
		if($.trim(empNo)!=''){
			o.empNo=empNo;
			flag=flag+1;
			j=j+1;
		}
		//代理人编号
		var agentNo=$('#agentNo'+i).val();
		if($.trim(agentNo)!=''){
			o.agentNo=agentNo;
			flag=flag+1;
		}
		if(j>=1&&j!=4){
			$.message("error","序号为"+i+"的数据存在必填项未填写，请填写");
			return;			
		}
		if($.trim(saleRate)!=''){
			if(i!=1){
				var o1=salemap1.get(i-1);
				if(o1==null||o1==undefined||o1==false){
					$.message("error","序号为"+i+"的上一个序号未填写不能跳号");
					return;		
				}
			}
			salemap1.put(i,o);
		}
		if($.trim(saleRate)!=''){
			arr1.push(o);
		}
	}
	var rate=0;
	var isEmp=false;
	for (var i = 1; i <= 5; i++) {
		if(salemap1.get(i)){
			//比例校验 所有人员类别是业务员的比例之和是1，其他类别只能是0.
			if(salemap1.get(i).personType=='1'){
				if(salemap1.get(i).agentFee==''||salemap1.get(i).agentFee==undefined){
				}else{
					rate=parseFloat(rate)+parseFloat(salemap1.get(i).agentFee)
				}
				isEmp=true;
			}else{
				if(salemap1.get(i).agentFee!='0'){
					$.message("error","所有人员类别是业务员的比例之和是1，其他类别只能是0");
					salemap1.clear();
					return;	
				}
			}
		}
	}
	if(parseFloat(rate)!=1&&isEmp){
		$.message("error","所有人员类别是业务员的比例之和是1，其他类别只能是0");
		salemap1.clear();
		return;
	}
	var insplanno = $('#hidepno').val();
	var flag=true;
	$.openLoading();
	if(insplanno!=null&&insplanno!=""){
		 var arr=JSON.stringify(arr1);
		$.ajax({
			url : "<%=path%>/noCarInsure/addTradPlanSale",
			type : 'POST',
			async : true,
			data:{
				planCode:insplanno,
				planType:'2',
				saleArry:arr
			},
			dataType:'json',
			success:function(result){
				if(result.result=='success'){
					$.closeLoading();
					salemap.clear();
					salemap=salemap1;
					saleTable();
					closeNocarAgentTypeDiv('sale_div');
					$.message("success", "添加成功");
				}else{
					$.message("error", "添加失败");
				}
			}
		});
	}else{
		$.closeLoading();
		salemap.clear();
		salemap=salemap1;
		saleTable();
		closeNocarAgentTypeDiv('sale_div');
		$.message("success", "添加成功");
		
	}
}
//销售人员table
function saleTable(){
	$('#saleShowDiv').html('');
	var ht='';
	for (var i = 1; i <=5; i++) {
		var o=salemap.get(i);
		if(o.personTypeName==undefined){
			o.personTypeName='';
		}
		if(o.empNo==undefined){
			o.empNo='';
		}
		if(o.salePerson==undefined){
			o.salePerson='';
		}
		if(o.agentNo==undefined){
			o.agentNo='';
		}
		if(o.practiceNo==undefined){
			o.practiceNo="";
		}
		if(o){
			ht+='<tr>'+
			'<td style="width:100px;text-align: center;">'+o.seqNo+'</td>'+
			'<td style="width:100px;text-align: center;">'+o.saleName+'</td>'+
			'<td style="width:100px;text-align: center;">'+o.agentFee+'</td>'+
			'<td style="width:100px;text-align: center;">'+o.practiceNo+'</td>'+
			'<td style="width:100px;text-align: center;">'+o.personTypeName+'</td>'+
			'<td style="width:100px;text-align: center;">'+o.empNo+'</td>'+
			'<td style="width:100px;text-align: center;">'+o.salePerson+'</td>'+
			'<td style="width:100px;text-align: center;">'+o.agentNo+'</td>'
		}
	}
	$('#saleShowDiv').html(ht);
}
//自定义map功能
function Map(){
  this.elements = new Array();
   //获取MAP元素个数
   this.size = function() {
       return this.elements.length;
   };
   //判断MAP是否为空
   this.isEmpty = function() {
       return (this.elements.length < 1);
   };
   //删除MAP所有元素
   this.clear = function() {
       this.elements = new Array();
   };
   //向MAP中增加元素（key, value)
   this.put = function(_key, _value) {
       if(this.containsKey(_key)){
        this.remove(_key);
        this.elements.push( {
           key : _key,
           value : _value
        });
       }else{
        this.elements.push( {
           key : _key,
           value : _value
        });
       }  
   };
   //删除指定KEY的元素，成功返回True，失败返回False
   this.remove = function(_key) {
       var bln = false;
       try {
           for (var i = 0; i < this.elements.length; i++) {
               if (this.elements[i].key == _key) {
                   this.elements.splice(i, 1);
                   return true;
               }
           }
       } catch (e) {
           bln = false;
       }
       return bln;
   };
   //获取指定KEY的元素值VALUE，失败返回NULL
   this.get = function(_key) {
       try {
           for (var i = 0; i < this.elements.length; i++) {
               if (this.elements[i].key == _key) {
                   return this.elements[i].value;
               }
           }
       } catch (e) {
           return false;
       }
       return false;
   };
   //判断MAP中是否含有指定KEY的元素
   this.containsKey = function(_key) {
       var bln = false;
       try {
           for (var i = 0; i < this.elements.length; i++) {
               if (this.elements[i].key == _key) {
                   bln = true;
               }
           }
       } catch (e) {
           bln = false;
       }
       return bln;
   };
  //获取map的所有values
  this.values = function() {
       var arr = new Array();
       for (var i = 0; i < this.elements.length; i++) {
           arr.push(this.elements[i].value);
       }
       return arr;
   };
  //获取map的所有keys
  this.keys= function() {
       var arr = new Array();
       for (var i = 0; i < this.elements.length; i++) {
           arr.push(this.elements[i].key);
       }
       return arr;
   };
   //获取数组
   this.getArray= function(){
   	var arr = new Array();
   	for (var i = 0; i < this.elements.length; i++) {
           arr.push({
	            key : this.elements[i].key,
	            value : this.elements[i].value
	         });
       }
       return arr;
   };
}
//-------------页面开始----------
var poolType = 0;
var prodType ='';
var agentTypeList = new Array();
var map = new Map();
var mapBak = new Map();
var salemap=new Map();
//------------------------------------------ 初始化本页面 开始----------------------------------------------
<%
String pno = "";
if(null != request.getAttribute("planCode")){
	pno = request.getAttribute("planCode").toString();
	System.out.print("================================================"+(StrUtil.isNotEmpty(pno)));
}
if(StrUtil.isNotEmpty(pno)){
%>
$(document).ready(function(){
	var insplanno = $('#hidepno').val();
	init(insplanno);
	$("#sbtn").attr("onclick","").unbind("click").click(function(){  
		checkAndExcute('update');
	});
	var sedVal=$("#newBsnsType option:selected").text();
	if(''==$('#agentFeeConfig').val()){
		if(sedVal.indexOf("直销") != -1){
			$("#agentNo").val("");
			$("#protocolNo").val("");
			$("#agentNo").attr("disabled",true);
			$("#protocolNo").attr("disabled",true);
			$("#agentNo").css({"background-color": "#ccc"});
			$("#protocolNo").css({"background-color": "#ccc"});
		}else{
			$("#agentNo").attr("disabled",false);
			$("#protocolNo").attr("disabled",false);
			$("#agentNo").css({"background-color": "#ccc"});
			$("#protocolNo").css({"background-color": "#ccc"});
		} 	
	}
	emailTemplate();
	if ('6'==$('#agentType').val()){
		$("#unionMessageConfig").css('display','');
	}
})
<%
} 
%>
function init(insplanno){
	$.ajax({
		url : "noCarInsure/loadInsuPlanInfo",
		type : 'POST',
		async : false,
		data:{planCode:insplanno},
		dataType:'json',
		success:function(data){
			if(data.message==undefined){
				$('#planCode').val(data.PLANCODE);
				$('#planName').val(data.PLANNAME);
				$('#prodCode').val(data.PRODCODE);
				$('#prodName').val(data.PRODNAME);
				econfirmType=data.ECONFIRMTYPE;
				epolicyType=data.EPOLICYTYPE;
				$('#partnerCode').val(data.PARTNERCODE);
				$('#businessPerformanceRate').val(data.BUSPERRATE);
				$('#marketPreserveRate').val(data.MARKPERRATE);
				$('#channelCodeQD').val(data.CHANNELCODE);
				$('#channelType').val(data.CHANNELTYPE);
				//加载方案名称与方案号
				document.getElementById("unionMessageConfigPlanNoTitle").innerHTML += data.PLANCODE;
				document.getElementById("unionMessageConfigPlanNameTitle").innerHTML += data.PLANNAME;
				//是否回执动态显示
				$('#isReceipt').val(data.ISRECEIPT);
				if(data.ISRECEIPT=='Y'){
					$('#isOrNotDisplayReceiptTypeDiv').show();
					$('#receiptType').val(data.RECEIPTTYPE);
				}
				channelFlag=data.channelFlag;
 				channelChannel(channelFlag);
				//是否批单
				$('#isedrno').val(data.ISEDRNO);
				if(data.ISEDRNO=='Y'){
					$('#isOrNotDisplayEdrnoTypeDiv').show();
					$('#edrnoType').val(data.EDRNOTYPE);
				}
				console.log(data);
				//是否保函
				$('#isEConfirm').val(data.ISECONFIRM);
				$('#isPushedSalesInfo').val(data.ISPUSHEDSALESINFO);
				$('#newBsnsType').val(data.NEWBSNSTYPE);
 				$('#bsnsType').val(data.BSNSTYPE);
 				$("#agentNoButtonHidden").empty();
 				var isbanchs=data.isBanchs;
				if(isbanchs){
					$('input[onclick!="openNocarAgentType4Div(1,this)"][onclick!="goBack()"][id!=confStatus4][id!=branch][id!=branchName][ onclick!="queryNocarConfProxyInfo4(1)"][onclick!="saveChooseNocarAgentType4()"][id!=cancelBtn]').attr("disabled",true);
					$('input[onclick!="openNocarAgentType4Div(1,this)"][id!=branch][id!=branchName]').css("background-color","#ccc");
					$('select[id!=confStatus4]').attr("disabled",true);
					$('select[id!=confStatus4]').css("background-color","#ccc");
					$('textarea').attr("disabled",true);
					$("#SendAccessoryBox").click(function(){
						return false;
					})
				}
 				if("19002"!=data.BSNSTYPE&&"19003"!=data.BSNSTYPE){
// 					$("#agentNo ~ span").remove(".red");
					$("#agentNo").val("");
					$('#agentNo').attr("disabled",true);
					$("#agentNo").css({"background-color": "#ccc"});
					$("#protocolNo").val("");
					$('#protocolNo').attr("disabled",true);
					$("#protocolNo").css({"background-color": "#ccc"});
					$("#protocolNo ~ span").remove(".red");
				}else{
					$("#agentNoButtonHidden").html("<span class='red' style='margin-left: -5px'>*</span>&nbsp;");
				}
 				$('#commRate').val(data.COMMRATE);
 				isDisable("agentType", true);
				$("#agentType").val(data.AGENTTYPE);
				//1、合作伙伴代理3、个人销售业务4、总对总销售业务
					$("tr[id^=agentType1]").css('display','none');
					$("tr[id^=agentType3]").css('display','none');
					$("tr[id^=agentType4]").css('display','none');
					$("tr[id^=agentType6]").css('display','none');
				if("1"==data.AGENTTYPE){
					$('#agentNo').val(data.AGENTNO);
					$('#agentNo').attr("disabled",false);
					$('#agentNo').css({"background-color": "#ccc"});
					$('#serviceCode').val(data.SERVICECODE);
					$('#serviceName').val(data.SERVICENAME);
					$('#empNo').val(data.EMPNO);
					$('#empName').val(data.EMPNAME);
					$('#teamCode').val(data.TEAMCODE);
					$('#teamName').val(data.TEAMNAME);
					$('#protocolNo').val(data.PROTOCOLNO);
					$('#protocolNo').attr("disabled",false);
					$("#protocolNo").css({"background-color": "#ccc"});
					$("tr[id^=qudaoandlaiyuan0]").css('display','');
					$("tr[id^=agentType1]").css('display','');
					$("tr[id^=agentType3]").css('display','none');
					$("tr[id^=agentType4]").css('display','none');
					$("#deptCode101").empty();
					$("#deptCode102").empty();
					$("#deptCode101").append("出单机构：");
					$("#deptCode102").append("<input id='deptCode'  type='text' readonly='readonly' style=' background-color: #ccc;' class='input_text'><span class='red'>*</span>&nbsp;<input type='button'  class='input_button_2' id='searchDeptBtn' value='请选择' onClick='openDeptDiv(1,this)' />");
					$('#deptCode').val(data.DEPTCODE);
					//querySauserAndTeamInfo();
				}else if("3"==data.AGENTTYPE){
					$("#cardApplicant_div").css('display','none');
					queryNocarConfProxyInfoEdit3(1);
					mapBak.clear();//清空备份map

					for(var o in data.map){  
			        	var obj = new Object();
			        	obj.id = data.map[o].id=="null"?"":data.map[o].id;
			        	obj.cardapplicant = data.map[o].cardapplicant=="null"?"":data.map[o].cardapplicant;
			        	obj.value = data.map[o].value=="null"?"":data.map[o].value;
			        	obj.businessRate=data.map[o].business=="null"?"":data.map[o].business;
			        	obj.marketRate=data.map[o].market=="null"?"":data.map[o].market;
			        	map.put(obj.id,obj);
			        	mapBak.put(obj.id,obj);
			      	}
					$("#agentType").val(data.AGENTTYPE);
					$("tr[id^=qudaoandlaiyuan0]").css('display','none');
					$("tr[id^=agentType1]").css('display','none');
					$("tr[id^=agentType3]").css('display','');
					$("tr[id^=agentType4]").css('display','none');
					$("#deptCode101").empty();
					$("#deptCode102").empty();
					$("#deptCode102").append("<input type='hidden' id='deptCode' value='' />");
				}else if("4"==data.AGENTTYPE){
					$("#cardApplicant_div").css('display','none');
					queryNocarConfProxyInfoEdit4(1);
					mapBak.clear();//清空备份map
// 					for(var o in data.map){  
// 			        	var obj = new Object();
// 			        	obj.id = data.map[o].id;
// 			        	obj.cardapplicant = data.map[o].cardapplicant=="null"?"":data.map[o].cardapplicant;
// 			        	obj.value = data.map[o].value=="null"?"":data.map[o].value;
// 			        	map.put(obj.id,obj);
// 			        	mapBak.put(obj.id,obj);
// 			      	}
					for(var o in data.map){  
			        	var obj = new Object();
			        	obj.id = data.map[o].id=="null"?"":data.map[o].id;
			        	obj.cardapplicant = data.map[o].cardapplicant=="null"?"":data.map[o].cardapplicant;
			        	obj.value = data.map[o].value=="null"?"":data.map[o].value;
			        	obj.businessRate=data.map[o].business=="null"?"":data.map[o].business;
			        	obj.marketRate=data.map[o].market=="null"?"":data.map[o].market;
			        	map.put(obj.id,obj);
			        	mapBak.put(obj.id,obj);
			      	}
					$("#agentType").val(data.AGENTTYPE);
					$("tr[id^=qudaoandlaiyuan0]").css('display','none');
					$("tr[id^=agentType1]").css('display','none');
					$("tr[id^=agentType3]").css('display','none');
					$("tr[id^=agentType4]").css('display','');
					$("#deptCode101").empty();
					$("#deptCode102").empty();
					$("#deptCode102").append("<input type='hidden' id='deptCode' value=''/>");
				}else if ("5" == data.AGENTTYPE){
					$("#cardApplicant_div").css('display','none');
					mapBak.clear();//清空备份map
					for(var o in data.map){  
			        	var obj = new Object();
			        	obj.id = data.map[o].id=="null"?"":data.map[o].id;
			        	obj.cardapplicant = data.map[o].cardapplicant=="null"?"":data.map[o].cardapplicant;
			        	obj.value = data.map[o].value=="null"?"":data.map[o].value;
			        	obj.businessRate=data.map[o].business=="null"?"":data.map[o].business;
			        	obj.marketRate=data.map[o].market=="null"?"":data.map[o].market;
			        	map.put(obj.id,obj);
			        	mapBak.put(obj.id,obj);
			      	}
					$('#agentFeeConfig').val(data.AGENTFEECONFIG);
					if(data.AGENTFEECONFIG!=null&&data.AGENTFEECONFIG!=''){
						agentFeeConfigChange();
					}
					$('#deptCode').val(data.DEPTCODE);
					if(data.AGENTFEECONFIG=='2'){
						$("tr[id^=agentType6]").css('display','');
						queryAgentInfoRela6(1);
					}
				}else if("6"==data.AGENTTYPE){
					isDisable("agentFeeConfig", false);
					$('#agentNo').val(data.AGENTNO);
					$('#serviceCode').val(data.SERVICECODE);
					$('#serviceName').val(data.SERVICENAME);
					$('#empNo').val(data.EMPNO);
					$('#empName').val(data.EMPNAME);
					$('#teamCode').val(data.TEAMCODE);
					$('#teamName').val(data.TEAMNAME);
					$('#protocolNo').val(data.PROTOCOLNO);
					$("tr[id^=qudaoandlaiyuan0]").css('display','');
					$("tr[id^=agentType1]").css('display','');
					$('#agentFeeConfig').val(data.AGENTFEECONFIG);
					if(data.AGENTFEECONFIG!=null&&data.AGENTFEECONFIG!=''){
						agentFeeConfigChange();
					}
					/* $("#deptCode101").empty();
					$("#deptCode102").empty();
					$("#deptCode101").append("出单机构：");
					$("#deptCode102").append("<input id='deptCode' readonly='readonly' style=' background-color: #ccc;' class='input_text'><span class='red'>*</span>&nbsp;&nbsp;<input type='button' class='input_button_2' value='请选择' onClick='openDeptDiv()' />");
 */					$('#deptCode').val(data.DEPTCODE);
					if(data.AGENTFEECONFIG=='2'){
						$("tr[id^=agentType6]").css('display','');
						queryAgentInfoRela6(1);
					}
				}else{
					$('#agentNo').val(data.AGENTNO);
					$('#serviceCode').val(data.SERVICECODE);
					$('#serviceName').val(data.SERVICENAME);
					$('#empNo').val(data.EMPNO);
					$('#empName').val(data.EMPNAME);
					$('#teamCode').val(data.TEAMCODE);
					$('#teamName').val(data.TEAMNAME);
					$('#protocolNo').val(data.PROTOCOLNO);
					$("tr[id^=qudaoandlaiyuan0]").css('display','');
					$("tr[id^=agentType1]").css('display','');
					$("tr[id^=agentType3]").css('display','none');
					$("tr[id^=agentType4]").css('display','none');
					$("#deptCode101").empty();
					$("#deptCode102").empty();
					$("#deptCode101").append("出单机构：");
					$("#deptCode102").append("<input id='deptCode'  type='text' readonly='readonly' style=' background-color: #ccc;' class='input_text'><span class='red'>*</span>&nbsp;<input type='button'  class='input_button_2' id='searchDeptBtn' value='请选择' onClick='openDeptDiv(1,this)' />");
					$('#deptCode').val(data.DEPTCODE);
				}
				if(data.EPOLICYINVOICE==''||data.EPOLICYINVOICE==null){
					$('#isEpolicyInvoice').val(2);
				}else{
					$('#isEpolicyInvoice').val(data.EPOLICYINVOICE);
				}
				var isEinvoice=$('#isEpolicyInvoice').val();
				if("1"==isEinvoice){
					$(".CinvockLink").show();
					$("#invockLink").val(data.INVOCKLINK);
					$("#isInsuranceEinvoice").val(data.ISINSURANCEEINVOICE);
					$("#payEinvoice").val(data.PAYEINVOICE);
					isInsurEinvoiceChange();
					$("#einvoiceInfo").show();
				}else{
					$(".CinvockLink").hide();
				}
				invockLinkChange('1');
				$("#dentification").val(data.DENTIFICATION);
				if(data.DREDGEPAY==''||data.DREDGEPAY==null||data.DREDGEPAY==1){
					$('#isDredgePay').val(1);
				}else{
					$('#isDredgePay').val(data.DREDGEPAY);
				}
				//是不是发送邮件
				if(data.EPOLICYMALI==''||data.EPOLICYMALI==null){
					$('#isEpolicyMali').val(2);
				}else{
					$('#isEpolicyMali').val(data.EPOLICYMALI);
				}
				if((data.EPOLICYMALI)==0||(data.EPOLICYMALI)==2){
					$('#MailTemplateTr').hide();
					$('#sendAccessory').hide();
					$('#sendAccessoryTd').hide();
				}
				if((data.EPOLICYMALI)=="1"){
					$('#sendAccessory').show();
					$('#sendAccessoryTd').show();
					$('#MailTemplateTr').show();
					var ids=new Array(5);
					ids=data.ids;
					if(ids!=null){
						$('input[name=SendAccessoryBox]').each(function(){
							for(i=0;i<ids.length;i++){
								if($(this).val()==ids[i]){
									$(this).attr("checked",true);
								}
							}
						});
					}
				}
				//是不是发送电子保单
				$('#isEpolicy').val(data.ISEPOLICY);
				if((data.ISEPOLICY)=="Y"){
					$('#Download_left').val(data.ISEPOLICY);
					$('#Download_right').show();
					$('#DownloadWay').show();
				}else{
					$('#Download_left').val(data.ISEPOLICY);
					$('#Download_right').hide();
				}
				//注销短信模板、短信接收人动态显示
				$('#isCancelMessage').val(data.ISCANCELMESSAGE);
				if(data.ISCANCELMESSAGE=='Y'){
					$('#cancelTemplateTr').show();
					//$('#cancelTemplate').css("background-color","white");
					$('#cancelTemplate').val(data.cancelTemplate_val).attr("disabled",true).css("background-color","rgb(204, 204, 204)");
					$('#isCancelTemplate').val(data.CANCELTEMPLATE);
					$('#cancelReceiverDiv').show();
					$('#cancelTemplateDiv').show();
					$('#cancelReceiver').val(data.CANCELRECEIVER);
				}
				
				$('#DownloadWay').val(data.DOWNLOADWAY);
				downloadWayChange('1');
				$('#fileType').val(data.FILETYPE);
				$('#MailTemplate').html(data.MAILTEMPLATE);   
				
				
				$('#specialArran').val(data.SPECIALARRAN);
				$('#status').val(data.STATUS);
				$('#isSeeMoney').val(data.ISSEEMONEY);
				if($('#isSeeMoney').val()=="N"){
					$('#isDredgePay').attr("disabled",true);
					$("#isDredgePay").css({"background-color": "#ccc"});
				}else{
					$("#isDredgePay").attr("disabled",false);
					$("#isDredgePay").css({"background-color": ""});
				}
				$('#isEpolicy').val(data.ISEPOLICY);
				
				$('#is_message').val(data.ISMESSAGE);
				if(data.ISMESSAGE=='Y'){
					$('#messageTemplateTr').show();
					//$('#messageTemplate').css("background-color","white");
					$('#messageTemplate').val(data.messageTemplate_val).attr("disabled",true).css("background-color","rgb(204, 204, 204)");
					$('#smsTemplate').val(data.MESSAGETEMPLATE);
					$('#messageReceiverDiv').show();
					$('#smsTemplateDiv').show();
					$('#messageReceiver').val(data.MESSAGERECEIVER);
				}
				if(null!=data.ISPRINTCARD){
					$('#isPrintCard').val(data.ISPRINTCARD);
					if(data.ISPRINTCARD=='Y'){
						$('#cardApplicant').attr("readonly",false);
						$('#cardApplicant').css("background-color","white");
						$('#cardApplicant').val(data.CARDAPPLICANT);
						$('#cardType').attr("readonly",false);
						$('#cardType').css("background-color","white");
						$('#cardType').val(data.CARDTYPE);
					}
				}
				if(data.SPECIALCONFIGTYPE){
					$('#specialConfigType').val(data.SPECIALCONFIGTYPE);
					if(data.SPECIALCONFIGTYPE=='1'){
						specialConfigTypeChange();
					}
				}
				var deptCode=$('#deptCode').val();
				//广东人员配置信息
				var sale=deptCode.substring(0,2);
				if(sale=='44'){
					$('#sale1').show();
					$('#sale2').show();
					//加载销售人员配置信息
				    var arr=data.sales;
					if(arr!=undefined&&arr.length>0){
						for (var i = 0; i < arr.length; i++) {
							var o=new Object();
							 o.seqNo=arr[i].seqNo
							 o.saleType=arr[i].saleType
							 o.agentFee=(parseFloat(arr[i].agentFee))
							 o.practiceNo=arr[i].practiceNo
							 o.personType=arr[i].personType
							 o.personTypeName=arr[i].personTypeName;
							 o.saleName=arr[i].saleTypeName
							 o.salePerson=arr[i].salePerson
							 o.empNo=arr[i].empNo;
							 o.agentNo=arr[i].agentNo;
							 salemap.put(arr[i].seqNo,o)
						}
						saleTable();
					}
				}else{
					$('#sale1').hide();
					$('#sale2').hide();
				}
			}else{
				$.message("error", "页面加载失败");
			}
       	}
	});
}
//加载接口传入(agentType==6)代理信息前，拼接参数
function queryAgentInfoRela6(pageIndex){
	var size = 5;
	var planNo = $.trim($('#hidepno').val());
	var agentType ="6";
	loadAgentInfoRela6({size:size,current:pageIndex,planNo:planNo,agentType:agentType});
}
/**特约配置方式*/
function specialConfigTypeChange(){
	var specialConfigType=$('#specialConfigType').val();
	if(specialConfigType=="1"){
		$('#specialArran').val('');
		$('#specialArran').attr("disabled",true);
		$("#specialArran").css({"background-color": "#ccc"});
	}else{
		$("#specialArran").attr("disabled",false);
		$("#specialArran").css({"background-color": ""});
	}
}
/**已配置的维度信息*/
var tdate="";
var title="";
function createTable(weids){
	var weidl=weids.split(",");
	tdate="";
	title="";
	for (var i = 0; i < weidl.length; i++) {
		if(weidl[i]==0){
			title='<th style="text-align: center;">机构</th>';
			tdate="branch,"
		}else if(weidl[i]==1){
			title+='<th style="text-align: center;">业务来源</th>';
			tdate+="channelSource,"
		}else if(weidl[i]==2){
			title+='<th style="text-align: center;">产品大类</th>';
			tdate+="productType,"
		}else if(weidl[i]==3){
			title+='<th style="text-align: center;">代理人代码/业务员代码</th>';
			tdate+="empNo,"
		}else if(weidl[i]==4){
			title+='<th style="text-align: center;">系统来源</th>';
			tdate+="sysSource,"
		}
	}
	title+='<th style="text-align: center;">手续费比例（%）</th><th style="text-align: center;">市场维护费比例（%）</th><th style="text-align: center;">业务绩效比例（%）</th>';
	tdate+='commRate,marketRate,businessRate';
}
//加载已配置的三费信息
function loadAgentInfoRela6(param){
	$.ajax({
		url : "<%=path%>/noCarSaleConfig/queryAgentInfoRelaPageByCriteria?"+new Date().getTime(),
		type : 'POST',
		async : true,
		data:param,
		dataType:'json',
		success:function(page){
			$.closeLoading();
			if(page.data&&page.data.length>0){
				if ($("#agentFeeConfig").val() == "2"){
					$('#agentNameTitle').html("跟单费用配置名称：" + page.data[0].agentNo + "-" +page.data[0].agentName);
				}else {
					$('#agentNameTitle').html("跟单费用配置名称："+page.data[0].agentName);
				}
				if(param.current=='1'){
					createTable(page.data[0].weidConfig);
				}
				$("#agentFeeTitle").html(title)
			}
			var fieldNames=tdate;
			var tableContent = creatTable1(fieldNames,page);
			var tableObj = $("#agentInfoRela6Table");
			tableObj.find("tbody").remove();
			tableObj.append(tableContent);
			
			var strPage = creatChannelPage3(param.current,6,page.maxPage,"64");
			var pageDIV = $("#agentInfoRela6PageDIV");
			pageDIV[0].innerHTML="";
			pageDIV.append(strPage);
		}
	});
}//加载已配置的三费信息结束

//是否回执
function chooseReceiptType(){
	var value = $('#isReceipt').val();
	var receiptType = $('#receiptType').val();
	if('Y' == value){
		$('#isOrNotDisplayReceiptTypeDiv').show();
	}else if('N' == value){
		$('#isOrNotDisplayReceiptTypeDiv').hide();
	}
}

//是否回执
function chooseIsedrno(){
	var value = $('#isedrno').val();
	var edrnoType = $('#edrnoType').val();
	if('Y' == value){
		$('#isOrNotDisplayEdrnoTypeDiv').show();
	}else if('N' == value){
		$('#isOrNotDisplayEdrnoTypeDiv').hide();
	}
}
//销售人员信息
function getSaleType(saleType){
	if(saleType=='1'){
		return '内部销售人员'
	}else if(saleType=='2'){
		return '外部销售人员'
	}
	return ''
}
//下载方式改变方式
function downloadWayChange(flag1){
	var flag=$('#DownloadWay').val();
	if(flag=='1'){
		$('#fileTypeSpan').show()
	}else{
		$('#fileTypeSpan').hide()
	}
	var isEpolicyMali =$('#isEpolicyMali').val();
	if(isEpolicyMali=='1'){
	  	setEmailTemplate(flag1);
	}
}
//销售人员类别
function getSaleType1(saleType){
	if(saleType=='1'){
		return '业务员'
	}else if(saleType=='2'){
		return '销售人员'
	}else if(saleType=='7'){
		return '渠道人员'
	}
	return ''
}
//绑定单选按钮事件，选中某个单选按钮，该按钮所在行高亮显示
function bindradio(){
	$("input[name='agentInfo6radioBox']").click(function(){
		$("input[name='agentInfo6radioBox']").parent().parent().removeClass("table_highlighter");
		$(this).parent().parent().addClass("table_highlighter");
   	});
	$("input[name='prodradio']").click(function(){
		$("input[name='prodradio']").parent().parent().removeClass("table_highlighter");
		$(this).parent().parent().addClass("table_highlighter");
   	});
	$("input[name='partnerradio']").click(function(){
		$("input[name='partnerradio']").parent().parent().removeClass("table_highlighter");
		$(this).parent().parent().addClass("table_highlighter");
   	});
	$("input[name='deptradio']").click(function(){
		$("input[name='deptradio']").parent().parent().removeClass("table_highlighter");
		$(this).parent().parent().addClass("table_highlighter");
   	});
	$("input[name='agentType3checkbox']").click(function(){
		var id= $(this).parent().parent().children(" td:eq(1)").html();
		if($(this).prop("checked")){//选中
			$(this).parent().parent().addClass("table_highlighter");
			var obj = new Object();
			var cardapplicant= $(this).parent().parent().children(" td:eq(7)").html();
			var value= $(this).parent().parent().find("input[name='value']").val();
			obj.id =id;
			obj.cardapplicant = cardapplicant;
			obj.value= value;
			obj.businessRate=$(this).parent().parent().find("input[name='businessRate']").val();
			obj.marketRate=$(this).parent().parent().find("input[name='marketRate']").val();
			map.put(obj.id,obj);
		}else{//取消选中
			$(this).parent().parent().removeClass("table_highlighter");
			$(this).prop("checked",false);
			map.remove(id);
		}
   	});
	$("input[name='agentType4checkbox']").click(function(){
		var id= $(this).parent().parent().children(" td:eq(1)").html();
		if($(this).prop("checked")){//选中
			$(this).parent().parent().addClass("table_highlighter");
			var obj = new Object();
		    var columnes=$("#agentTypeDiv4Table").find("th").length;
			if(columnes==16){
			var cardapplicant= $(this).parent().parent().children(" td:eq(10)").html();
			}else if(columnes==18){
			var cardapplicant= $(this).parent().parent().children(" td:eq(12)").html();
			}
			var value= $(this).parent().parent().find("input[name='value']").val();
			obj.id =id;
			obj.cardapplicant = cardapplicant;
			obj.value= value;
			obj.businessRate=$(this).parent().parent().find("input[name='businessRate']").val();
			obj.marketRate=$(this).parent().parent().find("input[name='marketRate']").val();
			map.put(obj.id,obj);
		}else{//取消选中
			$(this).parent().parent().removeClass("table_highlighter");
			$(this).prop("checked",false);
			map.remove(id);
		}
   	});
	$("#agentTypeDiv3CheckAll").click(function(){
		if($(this).prop("checked")){//选中
			$("#agentTypeDiv3Table tbody tr").each(function() {
				$(this).find("input[name='agentType3checkbox']").prop("checked",true);
				$(this).addClass("table_highlighter");
				var obj = new Object();
				var id= $(this).children(" td:eq(1)").html();
				var cardapplicant= $(this).children(" td:eq(7)").html();
				var value= $(this).find("input[name='value']").val();
				obj.id =id;
				obj.cardapplicant = cardapplicant;
				obj.value= value;
				obj.businessRate=$(this).find("input[name='businessRate']").val();
				obj.marketRate=$(this).find("input[name='marketRate']").val();
				map.put(obj.id,obj);
			});
		}else{//取消选中
			$("#agentTypeDiv3Table tbody tr").each(function() {
				$(this).removeClass("table_highlighter");
				$(this).find("input[name='agentType3checkbox']").prop("checked",false);
				var id= $(this).children(" td:eq(1)").html();
				map.remove(id);
			});
		}
	});
	$("#agentTypeDiv4CheckAll").click(function(){
		if($(this).prop("checked")){//选中
			$("#agentTypeDiv4Table tbody tr").each(function() {
				$(this).find("input[name='agentType4checkbox']").prop("checked",true);
				$(this).addClass("table_highlighter");
				var obj = new Object();
				var id= $(this).children(" td:eq(1)").html();
			    var columnes=$("#agentTypeDiv4Table").find("th").length;
				if(columnes==16){
					var cardapplicant= $(this).children(" td:eq(10)").html();
				}else if(columnes==18){
					var cardapplicant= $(this).children(" td:eq(12)").html();
				}
				
				var value= $(this).find("input[name='value']").val();
				obj.id =id;
				obj.cardapplicant = cardapplicant;
				obj.value= value;
				obj.businessRate=$(this).find("input[name='businessRate']").val();
				obj.marketRate=$(this).find("input[name='marketRate']").val();
				map.put(obj.id,obj);
			});
		}else{//取消选中
			$("#agentTypeDiv4Table tbody tr").each(function() {
				$(this).removeClass("table_highlighter");
				$(this).find("input[name='agentType4checkbox']").prop("checked",false);
				var id= $(this).children(" td:eq(1)").html();
				map.remove(id);
			});
		}
	});
}

//------------------------------------------ 初始化本页面 结束----------------------------------------------

//统一 关闭  窗口
function closeCurrentDIV(obj){
	$("#"+obj).CloseDiv();
}

//------------------------------------------ 产品  开始----------------------------------------------
//打开产品窗口
function openProdDiv(pageIndex,obj){
	$('#prodcode').val('');
	$('#proddesc').val('');
	$('#startDate').val('');
	$('#endDate').val('');

	$("#"+obj.id).blur();
	queryTradProdInst(pageIndex);
}

//调用拼接参数的方法，并执行查询
function queryTradProdInst(pageIndex){
	var size = 8;
	var code = $('#prodcode').val();
	var desc = $('#proddesc').val();
	var strReg = /^(\d{4})\-(\d{2})\-(\d{2})$/;
	var startDate = $('#startDate').val();
	var endDate = $('#endDate').val();
	var sflag = strReg.test(startDate);
	var eflag = strReg.test(endDate);
	if(null != startDate && "" != startDate){
		if(!sflag){
			$.message("error", "您输入的定义起期格式不正确，格式为：YYYY-MM-DD。请重新选择日期");
			$('#startDate').val('');
			return;
		}
	}
	if(null != endDate && "" != endDate){
		if(!eflag){
			$.message("error", "您输入的定义止期格式不正确，格式为：YYYY-MM-DD。请重新选择日期");
			$('#endDate').val('');
			return;
		}
	}
	queryAllProds({size:size,pageIndex:pageIndex,tradProdCode:code,tradProdDesc:desc,VstartDate:startDate,VendDate:endDate});
}

//查询产品
function queryAllProds(param){
	$.openLoading();
	$.ajax({
		url : "noCarInsure/loadTradProdInst",
		type : 'POST',
		async : true,
		data:param,
		dataType:'json',
		success:function(partnerPage){
			$.closeLoading();
			if(partnerPage.result=="fail"){
				$.message("error",partnerPage.message);

        		return;
        	}

			var radioObj ="<input class='input_fxk' name='prodradio' type='radio' value=''>";
			var fieldNames = "prodCode,prodName,prodType@TDH,agentType@TDH,epolicyType@TDH,econfirmType@TDH";
			var tableContent = creatTable1(fieldNames,partnerPage,radioObj);
			var tableObj = $("#productTable");
			tableObj.find("tbody").remove();
			tableObj.append(tableContent);
			
			var strPage = creatChannelPage(param.pageIndex,6,partnerPage.maxPage,"17");
			var pageDIV = $("#productPageDIV");
			pageDIV[0].innerHTML="";
			pageDIV.append(strPage);
			
			$("#prodDiv").OpenDiv();

			bindradio();
		}
	});
}
/**跟单费用配置改变**/
function agentFeeConfigChange(){
	var agentFeeConfig =$('#agentFeeConfig').val();
	var dptCode=$("#deptCode").val();
	/**接口传入*/
	 if('1'==agentFeeConfig){
		$('#empNo').val('');
		$('#empName').val('');
		$('#teamName').val('');
		$('#teamCode').val('');
		$('#agentNo').val('');
		$('#protocolNo').val('');
		$('#serviceCode').val('');
		$('#serviceName').val('');
		$('#channleCode_QD').val('');
		$('#channleType').val('');
		$('#newBsnsType').val('');
		$('#deptCode').val('');
		$('#bsnsType').val('');
		isDisable("empNo", true);
		$('input[onclick="openDeptDiv(1,this)"]').attr("disabled",true)
		isDisable("searchDeptBtn", true);
		isDisable("empName", true);
		isDisable("teamCode", true);
		isDisable("teamName", true);
		isDisable("agentNo", true);
		isDisable("protocolNo", true);
		isDisable("serviceCode", true);
		isDisable("serviceName", true)
		$('#cRate').html('手续费比例上限：');
		$('#mRate').html('市场维护费比例上限：');
		$('#bRate').html('业务绩效比例上限：');
		$('#agentType601').hide();
		isDisable("commRate", false);
		isDisable("businessPerformanceRate", false);
		isDisable("marketPreserveRate", false);
		$("tr[id^=qudaoandlaiyuan0]").css('display','none');
		$("tr[id^=agentType1]").css('display','');
		$("tr[id^=agentType6]").css('display','none');
	}else{
		isDisable("empNo", false);
		isDisable("empName", false);
		isDisable("teamCode", false);
		isDisable("teamName", false);
		isDisable("agentNo", false);
		isDisable("protocolNo", false)
		isDisable("serviceCode", false)
		isDisable("serviceName", false)
		$("#deptCode101").empty();
		$("#deptCode102").empty();
		$("#deptCode101").append("出单机构：");
		$("#deptCode102").append("<input id='deptCode'  type='text' readonly='readonly' style=' background-color: #ccc;' value='"+dptCode+"'class='input_text'><span class='red'>*</span>&nbsp;<input type='button'  class='input_button_2' id='searchDeptBtn' value='请选择' onClick='openDeptDiv(1,this)'//>");
		$("tr[id^=qudaoandlaiyuan0]").css('display','');
		$('#cRate').html('手续费比例：');
		$('#mRate').html('市场维护费比例：');
		$('#bRate').html('业务绩效比例：');
		$('#commRate').val('');
		if('2'==agentFeeConfig){
			$("tr[id^=qudaoandlaiyuan0]").css('display','none');
			$('#empNo').val('');
			$('#empName').val('');
			$('#teamName').val('');
			$('#teamCode').val('');
			$('#agentNo').val('');
			$('#protocolNo').val('');
			$('#serviceCode').val('');
			$('#serviceName').val('');
			$('#channleCode_QD').val('');
			$('#channleType').val('');
			$('#newBsnsType').val('');
			$('#deptCode').val('');
			$('#bsnsType').val('');
			$('#businessPerformanceRate').val('');
			$('#marketPreserveRate').val('');
			isDisable("empNo", true);
			$('input[onclick="openDeptDiv(1,this)"]').attr("disabled",true)
			isDisable("searchDeptBtn", true);
			isDisable("empName", true);
			isDisable("teamCode", true);
			isDisable("teamName", true);
			isDisable("agentNo", true);
			isDisable("protocolNo", true);
			isDisable("serviceCode", true);
			isDisable("serviceName", true)
			isDisable("businessPerformanceRate", true);
	        isDisable("marketPreserveRate", true);
			$('#agentType601').show();
			isDisable("commRate", true);
			
		}else{
			$("tr[id^=agentType6]").css('display','none');
			isDisable("commRate", false);
			isDisable("businessPerformanceRate", false);
	        isDisable("marketPreserveRate", false);
			$('#agentType601').hide();
		}
	}
}
function agentChange(){
	//1、合作伙伴代理3、个人销售业务4、总对总销售业务5、联合出单
	var agentType=$('#agentType').val();
	var agentType=$('#agentType').val();
	if($('#isThirdPlan').val()!='1'&&agentType=='6'){
		$('#agentType').val('1');
		if($("#partnerCode").val()==""){
			$.message('error',"请先选中合作伙伴");
		}else{
			$.message('error',"此合作伙伴不支持接口传入方案");
		}
		agentChange();
		return;
	}
	var dptCode=$("#deptCode").val()
	$('#agentFeeConfig').val('');
	isDisable("empNo", false);
	isDisable("empName", false);
	isDisable("teamCode", false);
	isDisable("teamName", false);
	isDisable("agentNo", false);
	isDisable("protocolNo", false)
	$('input[onclick="openDeptDiv()"]').attr("disabled",false)
	isDisable("serviceCode", false)
	isDisable("serviceName", false)
	isDisable("commRate", false);
	isDisable("businessPerformanceRate", false);
    isDisable("marketPreserveRate", false);
	$('#cRate').html('手续费比例：');
	$('#mRate').html('市场维护费比例：');
	$('#bRate').html('业务绩效比例：');
	isDisable("searchDeptBtn", false);
	$("tr[id^=agentType1]").css('display','none');
	$("tr[id^=agentType3]").css('display','none');
	$("tr[id^=agentType4]").css('display','none');
	$("tr[id^=agentType6]").css('display','none');
	if('1'==agentType){
		$("tr[id^=qudaoandlaiyuan0]").css('display','');
		$("#cardApplicant_div").css('display','');
		$("tr[id^=agentType1]").css('display','');
		$("tr[id^=agentType3]").css('display','none');
		$("tr[id^=agentType4]").css('display','none');
		$("#commRateSpan").empty();
		$("#deptCode101").empty();
		$("#deptCode102").empty();
		$("#deptCode101").append("出单机构：");
		$("#deptCode102").append("<input id='deptCode'  type='text' readonly='readonly' style=' background-color: #ccc;' class='input_text'><span class='red'>*</span>&nbsp;<input type='button'  class='input_button_2' id='searchDeptBtn' value='请选择' onClick='openDeptDiv(1,this)'//>");
	}else if('3'==agentType){
		$("tr[id^=qudaoandlaiyuan0]").css('display','none');
		$("#cardApplicant_div").css('display','none');
		$("tr[id^=agentType1]").css('display','none');
		$("tr[id^=agentType3]").css('display','');
		$("tr[id^=agentType4]").css('display','none');
		$("#commRateSpan").empty();
		$("#commRateSpan").append("销售业务信息未配置,则使用此比例");
		$("#deptCode101").empty();
		$("#deptCode102").empty();
		$("#deptCode102").append("<input type='hidden' id='deptCode' value='' />");
	}else if('4'==agentType){
		$("tr[id^=qudaoandlaiyuan0]").css('display','none');
		$("#cardApplicant_div").css('display','none');
		$("tr[id^=agentType1]").css('display','none');
		$("tr[id^=agentType3]").css('display','none');
		$("tr[id^=agentType4]").css('display','');
		$("#commRateSpan").empty();
		$("#commRateSpan").append("销售业务信息未配置,则使用此比例");
		$("#deptCode101").empty();
		$("#deptCode102").empty();
		$("#deptCode102").append("<input type='hidden' id='deptCode' value='' />");
	}else if('5'==agentType){
		$("tr[id^=qudaoandlaiyuan0]").css('display','none');
		$("#cardApplicant_div").css('display','none');
		$("tr[id^=agentType1]").css('display','none');
		$("tr[id^=agentType3]").css('display','none');
		$("tr[id^=agentType4]").css('display','none');
		$("#commRateSpan").empty();
		$("#commRateSpan").append("销售业务信息未配置,则使用此比例");
		$("#deptCode101").empty();
		$("#deptCode102").empty();
		$("#deptCode102").append("<input type='hidden' id='deptCode' value='' />");
		agentType5ChageChearData();
	}else if('6'==agentType){
		$("tr[id^=qudaoandlaiyuan0]").css('display','');
		$("#cardApplicant_div").css('display','');
		$("tr[id^=agentType1]").css('display','');
		$("tr[id^=agentType3]").css('display','none');
		$("tr[id^=agentType4]").css('display','none');
		$("#commRateSpan").empty();
		$("#deptCode101").empty();
		$("#deptCode102").empty();
		$("#deptCode101").append("出单机构：");
		$("#deptCode102").append("<input id='deptCode'  type='text' readonly='readonly' style=' background-color: #ccc;' class='input_text' value='"+dptCode+"'><span class='red'>*</span>&nbsp;<input type='button'  class='input_button_2' id='searchDeptBtn' value='请选择' onClick='openDeptDiv(1,this)'//>");
		$("#unionMessageConfig").css('display','');
		if ($('#planCode').val()==null || $('#planCode').val()==""){
			$('#unionMessageConfig').attr("disabled",true);
			$('#unionMessageConfig').css("background-color","#ccc");
		}
	}else{
		$("tr[id^=qudaoandlaiyuan0]").css('display','');
		$("#cardApplicant_div").css('display','none');
		$("tr[id^=agentType1]").css('display','');
		$("tr[id^=agentType3]").css('display','none');
		$("tr[id^=agentType4]").css('display','none');
		$("#commRateSpan").empty();
		$("#deptCode101").empty();
		$("#deptCode102").empty();
		$("#deptCode101").append("出单机构：");
		$("#deptCode102").append("<input id='deptCode'  type='text' readonly='readonly' style=' background-color: #ccc;' class='input_text'><span class='red'>*</span>&nbsp;<input type='button'  class='input_button_2' id='searchDeptBtn' value='请选择' onClick='openDeptDiv(1,this)'//>");
	}
	if('6'==agentType || '5'==agentType){
		isDisable("agentFeeConfig", false);
	}else{
		isDisable("agentFeeConfig", true);
	}
	if('6'!=agentType){
		$("#unionMessageConfig").hide();
	}
}
/**方案销售类型为“联合出单”时，清空以下录入数据*/
function agentType5ChageChearData(){
	$('#deptCode').val('');//出单机构
	$('#empNo').val('');//业务员代码
	$('#empName').val('');//业务员名称
	$('#teamCode').val('');//团队代码
	$('#teamName').val('');//团队名称
	$('#agentNo').val('');//代理人代码
	$('#protocolNo').val('');//代理协议号
	$('#serviceCode').val('');//服务代码
	$('#serviceName').val('');//服务名称
}

/**是否可以录入*/
function isDisable (obj,flag){
	//可用
	if(!flag){
		$("#"+obj).attr("disabled",false);
		$("#"+obj).css({"background-color": ""});
	}else{
		//不可用
		$("#"+obj).attr("disabled",true);
		$("#"+obj).css({"background-color": "#ccc"});
	}
}
//点击“确定” ，选择 产品
function chooseProd(){
	var selectedProd= $("input[name='prodradio']:checked");
	if(selectedProd.length==0){
		$.message("error", "请选择一个产品");
		return;
	}
	var prodCode = selectedProd.parent().parent().children(" td:eq(1)").html();//产品代码
	var prodName = selectedProd.parent().parent().children(" td:eq(2)").html();//产品代码
	    prodType = selectedProd.parent().parent().children(" td:eq(3)").html();//产品类型
	$('#prodCode').val(prodCode);
	epolicyType = selectedProd.parent().parent().children(" td:eq(5)").html();//保单类型
	econfirmType = selectedProd.parent().parent().children(" td:eq(6)").html();//保单类型
	$('#prodName').val(prodName);
	var agentType = selectedProd.parent().parent().children(" td:eq(4)").html();//销售类型
	/* $("#agentType").val(agentType); */
	closeCurrentDIV('prodDiv');
	//清空出单机构
	$("#deptCode").val("");
	$('#sale1').hide();
	$('#sale2').hide();
}
//------------------------------------------ 产品  结束----------------------------------------------

//------------------------------------------ 合作伙伴 开始----------------------------------------------
//initTradPartners
function queryPartner(param){
	$.openLoading();
	$.ajax({
		url : "noCarInsure/loadChannelInfo1",
		type : 'POST',
		async : true,
		data:param,
		dataType:'json',
		success:function(partnerPage){
			$.closeLoading();
			if($.validate(partnerPage))return;
					var radioObj ="<input class='input_fxk' name='partnerradio' type='radio' value=''>";
					var fieldNames = "channelCode@TDH,channelCode,channelName,clientNo@TDH,thirdPlan@TDH,channelFlag@TDH";
					var tableContent = creatTable1(fieldNames,partnerPage,radioObj);
					var tableObj = $("#TradPartnerTable");
					tableObj.find("tbody").remove();
					tableObj.append(tableContent);
					var strPage = creatChannelPage2(param.pageIndex,6,partnerPage.maxPage,"16");
					var pageDIV = $("#TradPartnerPageDIV");
					pageDIV[0].innerHTML="";
					pageDIV.append(strPage);
					
					$('#tradPartnerDiv').OpenDiv();
					
					bindradio();
			}
	});
}  



//打开合作伙伴 div 方法
function openThisDiv(divObj,pageIndex,obj){
	if(($.trim($('#prodCode').val())).length==0){
		$.message('error',"请先选择产品");
		return;
	}
	$('#channelCode').val('');
	$('#channelName').val('');
	$("#"+obj.id).blur();
	queryTradPartners(pageIndex);
}


//拼接页面查询参数  查询合作伙伴
function mergePartnerParams(pageIndex){
	var size = 8;
	var channelCode = $('#channelCode').val();
	var channelName = $('#channelName').val();
	queryPartner({pageIndex:pageIndex,size:size,channelCode:channelCode,channelName:channelName});
}



//查询 合作伙伴
function queryTradPartners(pageIndex){
	mergePartnerParams(pageIndex);
}
/**网销专属方案处理*/
function channelChannel(flag){
	if(flag=='1'){
		$('span[name="wxflag"]').hide()
		$('#state').removeAttr("readonly");
		$('#isPushedSalesInfo1').show();
		$('#isPushedSalesInfo2').show();
		$('#isInternetPlan').val("Y");
	}else{
		$('span[name="wxflag"]').show()
		$("#state").attr("readonly","readonly");
		$('#isPushedSalesInfo1').hide();
		$('#isPushedSalesInfo2').hide();
		$('#isInternetPlan').val("N");
	}
}


//点击“确定”按钮，选择合作伙伴
function choosePartner(){
	var selectedPartner = $("input[name='partnerradio']:checked");
	if(selectedPartner.length==0){
		$.message("error", "请选择一个合作伙伴");
		return;
	}
	var pno = selectedPartner.parent().parent().children(" td:eq(1)").html();
	var thirdPlan = selectedPartner.parent().parent().children(" td:eq(5)").html();
	var flag = selectedPartner.parent().parent().children("td:eq(6)").html();
	channelFlag=flag;
	channelChannel(flag);
	$('#partnerCode').val(pno);
	closeCurrentDIV('tradPartnerDiv');
	//清空出单机构
	$("#deptCode").val("");
	$('#isThirdPlan').val(thirdPlan);
	$('#sale1').hide();
	$('#sale2').hide();
}

function clearParams(){
	$('#tradPartnerNo').val('');
	$('#tradPartnerName').val('');
	$('#inspno').val('');
	$('#inspname').val('');
}
//------------------------------------------ 合作伙伴 结束----------------------------------------------
//------------------------------------------ 出单机构 开始----------------------------------------------
//打开机构窗口
function openDeptDiv(pageIndex,obj){
	
	if($.trim($('#partnerCode').val()).length==0){
		$.message("error", "请先选择合作伙伴代码");
		return;
	}
/* 	if(channelCodeQD.length==0){$.message('error',"请先选择归属渠道");return;}
	if(newBsnsType.length==0){$.message('error',"请先选择业务来源");return;} */
	$('#deptcode').val('');
	$('#deptcnname').val('');
	$("#"+obj.id).blur();
	queryCoreDept(pageIndex);
}

//调用拼接参数的方法，并执行查询
function queryCoreDept(pageIndex){
	var size = 8;
	var code = $('#deptcode').val();
	var name = $('#deptcnname').val();
	var pno = $('#partnerCode').val();
	queryAllDepts({size:size,pageIndex:pageIndex,deptCode:code,deptCNname:name,channelCode:pno});
}


//查询机构
function queryAllDepts(param){
	$.openLoading();
	$.ajax({
		url : "noCarInsure/loadCoreDept",
		type : 'POST',
		async : true,
		data:param,
		dataType:'json',
		success:function(deptPage){
			$.closeLoading();
			if($.validate(deptPage))return;

					var radioObj ="<input class='input_fxk' name='deptradio' type='radio' value=''>";
					var fieldNames = "deptCode,deptCNname";
					var tableContent = creatTable1(fieldNames,deptPage,radioObj);
					var tableObj = $("#deptTable");
					tableObj.find("tbody").remove();
					tableObj.append(tableContent);
					
					var strPage = creatChannelPage3(param.pageIndex,6,deptPage.maxPage,"18");
					var pageDIV = $("#deptPageDIV");
					pageDIV[0].innerHTML="";
					pageDIV.append(strPage);
					
					$("#deptDiv").OpenDiv();
					
					bindradio();
			}
	});
}

//点击“确定” ，选择 出单机构
function chooseDept(){
	var selectedDept= $("input[name='deptradio']:checked");
	if(selectedDept.length==0){
		$.message("error", "请选择一个出单机构");
		return;
	}
	var deptCode = selectedDept.parent().parent().children(" td:eq(1)").html();
	//广东分公司销售人员信息配置
	var sale=deptCode.substring(0,2);
	if(sale=='44'){
		$('#sale1').show();
		$('#sale2').show();
	}else{
		$('#sale1').hide();
		$('#sale2').hide();
	}
	$('#deptCode').val(deptCode);
	querySauserAndTeamInfo();
	closeCurrentDIV('deptDiv');
}

//------------------------------------------ 出单机构 结束----------------------------------------------

//添加 投保方案
function checkAndExcute(flag){

	var planCode = $('#planCode').val();
	var planName = $.trim($('#planName').val());
	if(planName.length==0){
		$.message("error", "请输入投保方案名称");
		$('#planName').focus();
		return;
	}
	var prodCode = $.trim($('#prodCode').val());
	if(prodCode.length==0){
		$.message("error", "请选择产品编号");
		$('#prodCode').focus();
		return;
	}
	var partnerCode = $.trim($('#partnerCode').val());
	if(partnerCode.length==0){
		$.message("error", "请选择合作伙伴代码");
		$('#partnerCode').focus();
		return;
	}
	var channelCode = $.trim($('#channelCodeQD').val());
	var channelType = $.trim($('#channelType').val());
	var newBsnsType = $.trim($('#newBsnsType').val());
	var bsnsType = $.trim($('#bsnsType').val());
	var agentFeeConfig=$("#agentFeeConfig").val();
	var agentType_val= $("#agentType").val();
	if($('#isThirdPlan').val()!='1'&&agentType_val=='6'&&flag!='update'){
		$.message('error',"此合作伙伴不支持接口传入方案");
		return;
	}
	var isEConfirm = $("#isEConfirm").val();
	var isPushedSalesInfo = $("#isPushedSalesInfo").val();
	//1、合作伙伴代理3、个人销售业务4、总对总销售业务
	var deptCode = $.trim($('#deptCode').val());
	if(agentType_val!="3"&&agentType_val!="4"&&agentType_val!="6"&&channelFlag!='1'&&agentType_val!="5"){
		if(deptCode.length==0){
			$.message("error", "请选择出单机构");
			$('#deptCode').focus();
			return;
		}
		// if(channelCode.length==0){
		// 	$.message("error", "请选择归属渠道");
		// 	$('#channelCodeQD').focus();
		// 	return;
		// }
		// if(channelType.length==0){
		// 	$.message("error", "请选择渠道类型");
		// 	$('#channelType').focus();
		// 	return;
		// }
		// if(newBsnsType.length==0){
		// 	$.message("error", "请选择新业务来源");
		// 	$('#newBsnsType').focus();
		// 	return;
		// }
		if(bsnsType.length==0){
			$.message("error", "请选择旧业务来源");
			$('#bsnsType').focus();
			return;
		}
	}
	//是否回执
	var isReceipt = $.trim($('#isReceipt').val()); //2015年6月1日11:56:40 wangyan add
	var receiptType = $('#receiptType').val();
	if('Y'== isReceipt){
		if($('#receiptType').val() == ""){
			$.message("error", "请选择回执类型");
			return;
		}
	}else if('N'== isReceipt){
		receiptType="";
	}
	//是否电子批单
	var isedrno = $.trim($('#isedrno').val()); 
	var edrnoType = $('#edrnoType').val();
	if('Y'== isedrno){
		if($('#isedrno').val() == ""){
			$.message("error", "请选择是否电子批单");
			return;
		}
	}else if('N'== isReceipt){
		edrnoType="";
	}
	var commRate = $.trim($('#commRate').val());
	var businessPerformanceRate=$.trim($('#businessPerformanceRate').val());
	var marketPreserveRate=$.trim($('#marketPreserveRate').val());
	var totalFee=0;
	if(agentFeeConfig!='2'){
		if(agentFeeConfig=='1'){
			if(commRate.length==0){
				$.message("error", "请输入手续费比例");
				$('#commRate').focus();
				return;
			}else{
			    var reg=/^0(\.\d{0,6})?$/;
			    var resultFlag1 = reg.test(commRate);
			    if(!resultFlag1){
			    	$.message("error","手续费比例上限：只能录入0到1之间的有效数字（最多6位小数）");
			    	return;
			    }
			}
			//业务绩效比例，市场维护比例
			if(marketPreserveRate.length==0){
				$.message("error", "请输入市场维护比例上限");
				$('#marketPreserveRate').focus();
				return;
			}else{
			 	var reg=/^0(\.\d{0,6})?$/;
			    var resultFlag1 = reg.test(marketPreserveRate);
			    if(!resultFlag1){
			    	$.message("error","市场维护比例上限：只能录入0到1之间的有效数字（最多6位小数）");
			    	return;
			    }
			}
			if(businessPerformanceRate.length==0){
				$.message("error", "请输入业务绩效比例上限");
				$('#businessPerformanceRate').focus();
				return;
			}else{
				var reg=/^0(\.\d{0,6})?$/;
			    var resultFlag1 = reg.test(businessPerformanceRate);
			    if(!resultFlag1){
			    	$.message("error","业务绩效比例上限：只能录入0到1之间的有效数字（最多6位小数）");
			    	return;
			    }
			}	
		}else{
			if(commRate.length==0){
				$.message("error", "请输入手续费比例");
				$('#commRate').focus();
				return;
			}else{
			    var reg=/^0(\.\d{0,6})?$/;
			    var resultFlag1 = reg.test(commRate);
			    if(!resultFlag1){
			    	$.message("error","手续费比例：只能录入0到1之间的有效数字（最多6位小数）");
			    	return;
			    }
			    var feeMaxRate = $.trim($('#feeMaxRate').val());
			    var feeMinRate = $.trim($('#feeMinRate').val());
			   
			    if(commRate > feeMaxRate){
				    $('#commRate').focus();
			    	$.message("error","手续费比例：超过上限");
			    	return;
			    }
			    if(commRate < feeMinRate){
				    $('#commRate').focus();
			    	$.message("error","手续费比例：低于下限");
			    	return;
			    }
			    totalFee=parseFloat(commRate);
			}
			//业务绩效比例，市场维护比例
			if(marketPreserveRate.length==0){
				$.message("error", "请输入市场维护比例");
				$('#marketPreserveRate').focus();
				return;
			}else{
			 	var reg=/^0(\.\d{0,6})?$/;
			    var resultFlag1 = reg.test(marketPreserveRate);
			    if(!resultFlag1){
			    	$.message("error","市场维护比例：只能录入0到1之间的有效数字（最多6位小数）");
			    	return;
			    }
			    totalFee=totalFee+parseFloat(marketPreserveRate);
			}
			if(businessPerformanceRate.length==0){
				$.message("error", "请输入业务绩效比例");
				$('#businessPerformanceRate').focus();
				return;
			}else{
				var reg=/^0(\.\d{0,6})?$/;
			    var resultFlag1 = reg.test(businessPerformanceRate);
			    if(!resultFlag1){
			    	$.message("error","业务绩效比例：只能录入0到1之间的有效数字（最多6位小数）");
			    	return;
			    }
			    totalFee=totalFee+parseFloat(businessPerformanceRate);
			}
			if(totalFee>=1){
				$.message("error","市场维护费比例、业务绩效比例、手续费比例之和必须小于1");
		    	return;
			}
		}
	}
	var status = $.trim($('#status').val());
	if('3'==agentType_val||('4'==agentType_val&&channelFlag!='1')){
		if(flag=="add"){
			if(status==1){//状态为有效
				$.message("error", "销售业务信息为空,保存方案并配置销售业务信息后才能修改为有效");
				return;
			}
		}
		if(flag=="update"){
			if(status==1){//状态为有效
				if(mapBak.isEmpty()){
					$.message("error", "销售业务信息为空,配置销售业务信息后才能修改为有效");
					return;
				}	
			}
		}
	}
	var isInternetPlan = $.trim($('#isInternetPlan').val());
	var isPushedSalesInfo = $.trim($('#isPushedSalesInfo').val());
	if('Y'== isInternetPlan && '1'== agentType_val && 'N' == isPushedSalesInfo){
		if(flag=="add"){
			if(status==1){//状态为有效
				$.message("error", "该方案为网销专属方案，推送销售信息后才能修改为有效");
				return;
			}
		}
		if(flag=="update"){
			if(status==1){//状态为有效
				if(mapBak.isEmpty()){
					$.message("error", "该方案为网销专属方案，推送销售信息后才能修改为有效");
					return;
				}
			}
		}
	}
	//1、合作伙伴代理3、个人销售业务4、总对总销售业务
	var serviceCode='';
	var serviceName='';
	var empNo='';
	var empName='';
	var teamCode='';
	var teamName='';
	var agentNo='';
	var protocolNo ='';
	serviceCode = $.trim($('#serviceCode').val());
	serviceName = $.trim($('#serviceName').val());
	empName = $.trim($('#empName').val());
	
	teamCode = $.trim($('#teamCode').val());
	teamName = $.trim($('#teamName').val());
	empNo = $.trim($('#empNo').val());
	protocolNo = $.trim($('#protocolNo').val());
	agentNo = $.trim($('#agentNo').val());
	if(agentType_val=="1"&&channelFlag!='1'){
		if(serviceCode.length==0){
			$.message("error", "请输入服务代码");
			$('#serviceCode').focus();
			return;
		}
	
		if(empNo.length==0){
			$.message("error", "请输入业务员代码");
			$('#empNo').focus();
			return;
		}
		if(teamCode.length==0){
			$.message("error", "请输入团队代码");
			$('#teamCode').focus();
			return;
		}
		//原业务来源为19002-代理或19003-经纪，则代理人代码和代理协议号必填，其他非必填
		if(bsnsType=="19002"||bsnsType=="19003"){
			if(agentNo.length==0){
				$.message("error", "请输入代理人代码");
				$('#agentNo').focus();
				return;
			}
			if(protocolNo.length==0){
				$.message("error", "请输入代理协议号");
				$('#protocolNo').focus();
				return;
			}
		}
	}
	//是否电子保单
	var isEpolicy_val = $('#isEpolicy').val();
	var $DownloadWay_val='';
	var fileType='';
	if(isEpolicy_val==''){
		 $.message("error", "请选择是否电子保单");
		return;
	}else if(isEpolicy_val=='Y'){
		 $DownloadWay_val=$.trim($('#DownloadWay').val());
		 if( $DownloadWay_val=='1'){
			 fileType=$('#fileType').val(); 
		 }
	}else{
		$DownloadWay_val='';
	}
	  //是否发送电子发票
	var isEpolicyInvoice=$('#isEpolicyInvoice').val();
	if( isEpolicyInvoice==''){
		$.message("error","请选择是否发送电子发票");
		return ;
	}
	
	var payEinvoice="";
	var isInsuranceEinvoice="";
	if(isEpolicyInvoice=='1'){
		payEinvoice=$("#payEinvoice").val();
		isInsuranceEinvoice=$("#isInsuranceEinvoice").val();
	}
		
	//是否开通支付平台
	var $isDredgePay=$.trim($('#isDredgePay').val());
	//是否见费出单
	var isSeeMoney = $.trim($('#isSeeMoney').val());
	if($isDredgePay==''){
		$.message('error',"请选择是否开通支付平台");
		return;
	}
	if(isSeeMoney=="N"){
		$isDredgePay="";
	}
	//是否发送邮件
	var $isEpolicyMali=$.trim($('#isEpolicyMali').val());
	//邮件模板
	var $MailTemplate=$.trim($('#MailTemplate').val());
	//转码，可能会传入html的数据
	if($MailTemplate!=null){
		$MailTemplate=encodeURI($MailTemplate);
	}
	//获取附加数组
	var selectAccessorys=$('input[name=SendAccessoryBox]:checked');
	//定义一个转换后的字符串
	var selectAccessorylistStr='';
	//判断数组长度
	if(selectAccessorys.length!=0){
		//循环添加
		selectAccessorys.each(function(i){
			var object=new Object();
			object.id=$(this).val();
			map.put(object.id,object);
		});
	}
	//判断map是否为空
	if(!map.isEmpty()){
		//定义list
		var selectAccessorylist =new  Array();
		//循环k值
		for(i in map.keys()){
			//得到key
			var key=map.keys()[i];
			//得到值
			selectAccessorylist.push(map.get(key));
		}
		//转换成字符串
		selectAccessorylistStr=JSON.stringify(selectAccessorylist);
	}
	//是否发送邮件
	if($isEpolicyMali=='1'){
		if($.trim($('#MailTemplate').val()).length==0){
			$.message('error',"请输入邮件模板配置");
			$('#MailTemplate').focus();
			return ;
		}
	}else{
		$MailTemplate="";
		selectAccessorylistStr="";
	}


	var $isEpolicyMali=$.trim($('#isEpolicyMali').val());
	//当“是否打印单证”的值为“是”时，单证领用人可输入
	var isPrintCard_val = $.trim($('#isPrintCard').val());
	var cardType_val = $("#cardType").val();
	var cardApplicant_val =$.trim($('#cardApplicant').val());
	if(isPrintCard_val==''){
		$.message("error", "请选择是否打印单证");
		return;
	}else if(isPrintCard_val=="Y"){
		if(cardType_val==''){
			$.message("error", "单证类型不能为空");
			$('#cardType').focus();
			return;
		}
		if("1"==agentType_val){
			if($.trim($('#cardApplicant').val()).length==0){
				$.message("error", "单证领用人不能为空");
				$('#cardApplicant').focus();
				return;
			}
		}else if('3'==agentType_val||'4'==agentType_val){
			if(flag=="update"){
				for(i in mapBak.keys()){
					var key = mapBak.keys()[i];
					if(mapBak.get(key).cardapplicant==""){
						$.message("error", "您配置的销售业务信息中存在单证领用人为空的,单证领用人不能为空");
						return;
					}
				}
			}
		}else{
			if($.trim($('#cardApplicant').val()).length==0){
				$.message("error", "单证领用人不能为空");
				$('#cardApplicant').focus();
				return;
			}
		}
	}
	//当“是否发送短信”的值为“是”时，短信模板配置
	var isMessage_val = $.trim($('#is_message').val());
	if(isMessage_val=='Y'){
		if($('#messageReceiver').val()==""){
			$.message("error", "请选择承保短信接收人");
			return;
		}
		if($.trim($('#messageTemplate').val()).length==0){
			$.message("error", "承保短信模板配置不能为空");
			$('#messageTemplate').focus();
			return;
		}
	}
	//注销短信
	var isCancelMessage=$('#isCancelMessage').val();
	var cancelReceiver=$.trim($('#cancelReceiver').val());
	var cancelTemplate_val=$.trim($('#cancelTemplate').val());
	var cancelTemplate = $('#isCancelTemplate').val();
	if(cancelTemplate_val!=null){
		cancelTemplate_val=encodeURI(cancelTemplate_val);
	}
	if(isCancelMessage=="Y"){
		if(cancelReceiver.length==0){
			$.message("error", "请选择注销短信接收人");
			return;
		}
		if(cancelTemplate_val.length==0){
			$.message("error", "注销短信模板配置不能为空");
			return;
		}
	}else{
		cancelReceiver='';
		cancelTemplate='';
	}
	var poolInsureCompany="";
	var poolProcotol ="";
	var poolProcotolNo = "";
	var poolIssueFlag = "";
	var poolAgentRate = "";
	var poolRate = "";
	var poolInsureAmount = "";
	var poolRole = "";
	
	var specialArran = $.trim($('#specialArran').val());
	var messageTemplate_val =$.trim($('#smsTemplate').val());
	var messageReceiver_val = $('#messageReceiver').val();
	 if(isMessage_val=='N'){//如果发送短信选择否，短信模板和接收人应当是空 
		 messageTemplate_val="";
		 messageReceiver_val="";
     }
	 var specialConfigType=$('#specialConfigType').val();
	 if(specialConfigType=='1'){
		 specialArran='';
	 }
	 var invockLink ="";
		if(isEpolicyInvoice=='1'){
			invockLink=$("#invockLink").val();
		}
		var dentification=$('#dentification').val();
	//保存销售信息
	if(flag=="add"){
		/**是否上线产品*/
		var isProprod=false;
		if($("#isProprod").is(':checked')){
			isProprod=true;
		}
		var arr='';
		var arr1 = new Array(); 
		var sale=deptCode.substring(0,2);
		if(sale=='44'){
			for (var i = 1; i <= 5; i++) {
				if(salemap.get(i)){
					arr1.push(salemap.get(i));
				}
			}
			 arr=JSON.stringify(arr1);
		}
		excuteAdd({fileType:fileType,
			isCancelMessage:isCancelMessage,cancelReceiver:cancelReceiver,cancelTemplate:cancelTemplate,
			planType:'2',
			saleArry:arr,
			prodCode     :prodCode,
			planName     :planName,
			partnerCode  :partnerCode ,
			channelCode  :channelCode,
			channelType  :channelType ,
			serviceCode  :serviceCode ,
			serviceName	 :serviceName,
			commRate     :commRate,
			isSeeMoney   :isSeeMoney ,
			empNo        :empNo ,
			empName		 :empName,
			teamCode     :teamCode,
			teamName     :teamName,
			bsnsType     :bsnsType ,
			newBsnsType  :newBsnsType ,
			deptCode     :deptCode,
			agentNo      :agentNo ,
			specialArran :specialArran ,
			status       :status ,
			isMessage :isMessage_val,
			messageTemplate:messageTemplate_val,
			messageReceiver:messageReceiver_val,
			prodType	 :prodType,
			protocolNo   :protocolNo,
			isEpolicy    :isEpolicy_val,
			isPrintCard  :isPrintCard_val,
			cardType     :cardType_val,
			cardApplicant:cardApplicant_val,
			DredgePay:$isDredgePay,
			EpolicyMali:$isEpolicyMali,
			MailTemplate:$MailTemplate,
			selectAccessorylistStr:selectAccessorylistStr,
			DownloadWay:$DownloadWay_val,
			EpolicyInvoice:isEpolicyInvoice,
			agentType:agentType_val,
			agentFeeConfig:agentFeeConfig,
			businessPerformanceRate:businessPerformanceRate,
			marketPreserveRate:marketPreserveRate,
			specialConfigType:specialConfigType,
			isProprod:isProprod,invockLink:invockLink,dentification:dentification,isReceipt:isReceipt,receiptType:receiptType,
			isedrno:isedrno,edrnoType:edrnoType,isInsuranceEinvoice:isInsuranceEinvoice,payEinvoice:payEinvoice,channelFlag:channelFlag,
			isEConfirm:isEConfirm,isPushedSalesInfo:isPushedSalesInfo
		});
	}
	if(flag=="update"){
		if("6"==agentType_val&&$("#agentFeeConfig").val()==""){
			$.message("error", "方案销售类型为接口传入方案时，跟单费用配置不能为空");
			return;
		}
		if("5"==agentType_val&&$("#agentFeeConfig").val()==""){
			$.message("error", "方案销售类型为联合出单时，跟单费用配置不能为空");
			return;
		}
 		excuteUpdate({fileType:fileType,isCancelMessage:isCancelMessage,cancelReceiver:cancelReceiver,cancelTemplate:cancelTemplate,
			planCode     :planCode ,
			prodCode     :prodCode,
			planName     :planName,
			partnerCode  :partnerCode ,
			channelCode  :channelCode,
			channelType  :channelType ,
			serviceCode  :serviceCode ,
			serviceName	 :serviceName,
			commRate     :commRate,
			isSeeMoney   :isSeeMoney ,
			empNo        :empNo ,
			empName		 :empName,
			teamCode     :teamCode,
			teamName     :teamName,
			bsnsType     :bsnsType ,
			newBsnsType  :newBsnsType ,
			deptCode     :deptCode,
			agentNo      :agentNo ,
			specialArran :specialArran ,
			status       :status ,
			isMessage    :isMessage_val,
			messageTemplate:messageTemplate_val,
			messageReceiver:messageReceiver_val,
			protocolNo   :protocolNo,
			isEpolicy    :isEpolicy_val,
			isPrintCard  :isPrintCard_val,
			cardType     :cardType_val,
			cardApplicant:cardApplicant_val,
			DredgePay:$isDredgePay,
			EpolicyMali:$isEpolicyMali,
			MailTemplate:$MailTemplate,
			selectAccessorylistStr:selectAccessorylistStr,
			DownloadWay:$DownloadWay_val,
			EpolicyInvoice:isEpolicyInvoice,
			agentType:agentType_val,
			agentFeeConfig:agentFeeConfig,
			businessPerformanceRate:businessPerformanceRate,
			marketPreserveRate:marketPreserveRate,
			specialConfigType:specialConfigType
			,invockLink:invockLink,dentification:dentification
			,isReceipt:isReceipt,receiptType:receiptType,
			isedrno:isedrno,edrnoType:edrnoType,isInsuranceEinvoice:isInsuranceEinvoice,payEinvoice:payEinvoice,channelFlag:channelFlag,
			isEConfirm:isEConfirm,isPushedSalesInfo:isPushedSalesInfo
		});
	}
}


//执行修改
function excuteUpdate(param){
	$.openLoading();
	$.ajax({
		url : "noCarInsure/updateInsuPlanInfo",
		type : 'POST',
		async : true,
		data:param,
		dataType:'json',
		success:function(data){
			$.closeLoading();
			if($.validate(data))return;
			back('edit');
		}
	});
}

//执行添加
function excuteAdd(param){
	$.openLoading();
	$.ajax({
		url : "noCarInsure/addTradInsuPlan",
		type : 'POST',
		async : true,
		data:param,
		dataType:'json',
		success:function(data){
			$.closeLoading();
			if("success"==data.result&&""!=data.message){
				if(data.data.AgentType=="1"){
					$.message("success", data.message);
					back('add');
				}else if(data.data.AgentType=="3"){
					$.message("success", data.message);
					//保存完更新方案号
					window.location.href='<%=path%>/noCarInsure/edit?planCode='+data.data.InsuPlanNo;
				}else if(data.data.AgentType=="4"){
					$.message("success", data.message);
					//保存完更新方案号
					window.location.href='<%=path%>/noCarInsure/edit?planCode='+data.data.InsuPlanNo;
				}else if(data.data.agentFeeConfig=="2"){
					$.message("success", data.message);
					//保存完更新方案号
					window.location.href='<%=path%>/noCarInsure/edit?planCode='+data.data.InsuPlanNo;
				}else{
					$.message("success", data.message);
					back('add');
				}
	    	}
			if("fail"==data.result){
	    		$.message("error", "系统错误,请联系管理员");
	    	}
			if("error"==data.result&&""!=data.message){
	    		$.message("error", data.message);
	    	}
		}
	});
}


//返回
function back(obj){
	if(obj=='edit'){
		this.location.href = "<%=path%>/noCarInsure/success?flag=edittrue";
	}
	if(obj=='add'){
		this.location.href = "<%=path%>/noCarInsure/success?flag=addtrue";
	}
}

function clearNoNum(event,obj){ 
    //响应鼠标事件，允许左右方向键移动 
    event = window.event||event; 
    if(event.keyCode == 37 | event.keyCode == 39){ 
        return; 
    } 
    //先把非数字的都替换掉，除了数字和. 
    obj.value = obj.value.replace(/[^\d.]/g,""); 
    //必须保证第一个为数字而不是. 
    obj.value = obj.value.replace(/^\./g,""); 
    //保证只有出现一个.而没有多个. 
    obj.value = obj.value.replace(/\.{2,}/g,"."); 
    //保证.只出现一次，而不能出现两次以上 
    obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$","."); 
} 
function checkNum(obj){ 
    //为了去除最后一个. 
    obj.value = obj.value.replace(/\.$/g,""); 
}
function clearNoNum1(event,obj){ 
	obj.value = obj.value.replace(/[^\d.]/g,"");  //清除“数字”和“.”以外的字符   
	  obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个. 清除多余的   
	  obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");  
	  obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');//只能输入两个小数   
	  if(obj.value.indexOf(".")< 0 && obj.value !=""){//以上已经过滤，此处控制的是如果没有小数点，首位不能为类似于 01、02的金额  
	   obj.value= parseFloat(obj.value);  
	  }  	
} 
//返回按钮
function goBack(){
	this.location.href = "<%=path%>/noCarInsure/list";
}
//当“是否打印单证”的值为“是”时，单证领用人可输入
function checkPrintCard(){
	var type = $('#isPrintCard').val();
	if(type=='Y'){
		$('#cardApplicant').attr("readonly",false);
		$('#cardApplicant').css("background-color","white");
		$('#cardType').attr("readonly",false);
		$('#cardType').css("background-color","white");
	}else{
		$('#cardApplicant').val('');
		$('#cardApplicant').attr("readonly",true);
		$('#cardApplicant').css("background-color","#ccc");
		$('#cardType').val('');
		$('#cardType').attr("readonly",true);
		$('#cardType').css("background-color","#ccc");
	}
}
//当“是否发送短信”的值为“是”时，短信模板配置可输入
function checkIsMessage(){
	var value = $('#is_message').val();
	if(value=='Y'){
		$('#messageTemplateTr').show();
		//$('#messageTemplate').css("background-color","white");
		$('#messageTemplate').attr("disabled",true).css("background-color","rgb(204, 204, 204)");
		$('#messageReceiverDiv').show();
		$("#messageTemplate").val("");
		$('#smsTemplateDiv').show();
	}else{
		$('#messageTemplateTr').hide();
		$('#messageTemplate').val('');
		$('#messageReceiverDiv').hide();
		$("#smsTemplate").val("");
		$('#smsTemplateDiv').hide();
	}
}

//展示选中的注销短信模板
function changeIsCacelTemplate(){
	var value = $('#isCancelTemplate').val();
	if(value ==null || "" == value || "0" == value){
		$('#cancelTemplate').val("");
		return false;
	}
	 $.ajax({
		 	url : "<%=path%>/noCarInsure/loadTemplate",
			type : 'POST',
			async : true,
			dataType:'json',
			data:{smsTemplateCode:value},
			success : function(obj) {
				var smsTemplate = obj;
				$('#cancelTemplate').val(obj.smsTemplateText);
			}
	});
}
$(document).ready(function(){
	salesInfoReadOnly();
	//归属渠道
	$("#channelCodeQD").change(function(){
		var parentCode = $("#channelCodeQD").val();
		$('#channelType').attr("disabled",false).css('background-color','white');
		$('#newBsnsType').attr("disabled",false).css('background-color','white');
		subDropDownList("channel_type",parentCode,"channelType");
		subDropDownList("new_business_source","","newBsnsType");
	});
	//渠道类型
	$("#channelType").change(function(){
		var parentCode = $("#channelType").val();
		subDropDownList("new_business_source",parentCode,"newBsnsType");
		if(parentCode==''){
			$("#bsnsType").val('');
		}
	});
	//新业务来源
	$("#newBsnsType").change(function(){
		var parentCode = $("#channelType").val();
		var newBsnsCode = $("#newBsnsType").val();
		chooseBsnsType(parentCode,newBsnsCode);
		var bsnsType = $.trim($("#bsnsType").val());
		if(bsnsType == '19001'){queryServiceNo();}
		var sedVal=$("#newBsnsType option:selected").text();
		if(sedVal.indexOf("直销") != -1){
			$("#agentNo").val("");
			$("#protocolNo").val("");
			$("#agentNo").attr("disabled",true);
			$("#protocolNo").attr("disabled",true);
			$("#agentNo").css({"background-color": "#ccc"});
			$("#protocolNo").css({"background-color": "#ccc"});
		}else{
			$("#agentNo").attr("disabled",false);
			$("#protocolNo").attr("disabled",false);
			$("#agentNo").css({"background-color": "#ccc"});
			$("#protocolNo").css({"background-color": "#ccc"});
		}
		if(bsnsType != '19001'){queryAgentAndAgreeInfo();}
	});
	//旧业务来源
	$("#bsnsType").change(function(){
		var newBsnsCode = $("#newBsnsType").val();
		var bsnsTypeCode = $("#bsnsType").val();
		//原业务来源为19002-代理或19003-经纪，则代理人代码和代理协议号必填，其他非必填
		$("#agentNoButtonHidden").empty();
		if(bsnsTypeCode!="19002"&&bsnsTypeCode!="19003"){
 			$("#agentNo ~ span").remove(".red");

			$("#agentNo").val("");
			$('#agentNo').attr("disabled",true);
			$("#agentNo").css({"background-color": "#ccc"});
			$("#protocolNo").val("");
			$('#protocolNo').attr("disabled",true);
			$("#protocolNo").css({"background-color": "#ccc"});
			$("#protocolNo ~ span").remove(".red");
		}else{
			$("#agentNo").attr("disabled",false);
			$("#agentNo").css({"background-color": "#ccc"});
			$("#protocolNo").attr("disabled",false);
			$("#protocolNo").css({"background-color": "#ccc"});
			if($("#protocolNo ~ span").length==0){
				$("#protocolNo").parent().append("<span class='red'>*</span>");
			}
			$("#agentNoButtonHidden").html("<span class='red' style='margin-left: -5px'>*</span>&nbsp; ");
		}
	});
	
});
//下拉框处理
function subDropDownList(codeType,element1,element2){
	$.ajax({
		url : "<%=path%>/noCarInsure/loadSubDropList",
		type : 'POST',
		async : false,
		data:{codeType:codeType,parentCode:element1},
		dataType:'json',
		success:function(appList){
			if($.validate(appList))  return;
			var appSelect = document.getElementById(element2);
			appSelect.options.length = 0;
			if (appList != null) {
				for (var i = 0; i < appList.length; i++) {
					var option = new Option();
					option.text = appList[i].codeName;
					option.value = appList[i].code;
					appSelect.add(option);
				}
			}
       	}
	});
}
//选择旧业务来源
function chooseBsnsType(parentCode,newBsnsCode){
	$.ajax({
		url : "<%=path%>/noCarInsure/chooseBsnsType",
		type : 'POST',
		async : false,
		data:{parentCode:parentCode,newBsnsCode:newBsnsCode},
		dataType:'json',
		success:function(data){
				if($.validate(data))  return;
				if (data != null) {
					$("#bsnsType").val(data.otherCode);
					//原业务来源为19002-代理或19003-经纪，则代理人代码和代理协议号必填，其他非必填
					$("#agentNoButtonHidden").empty();
					if(data.otherCode=="19002"||data.otherCode=="19003"){
						$("#agentNoButtonHidden").html("<span class='red' style='margin-left: -5px'>*</span>&nbsp; ");	
						if($("#protocolNo ~ span").length==0){
							$("#protocolNo").parent().append("<span class='red'>*</span>");
						}
					}else{
						$("#protocolNo ~ span").remove(".red");
					}
				}
       	}
	});
}
//------------------------------------------配置代理信息开始--------------------------------------------
//统一 关闭  窗口
function closeNocarAgentTypeDiv(obj){
	var selectedAgentType = $("input[name^=agentType]:checked");
	if(selectedAgentType.length!=0){
		selectedAgentType.each(function(i){
			$(this).prop("checked",false);
		});
	}
	map.clear();
	for(i in mapBak.keys()){
      var key = mapBak.keys()[i];
      map.put(key,mapBak.get(key));
  	}
	$("#"+obj).CloseDiv();	
}
//打开产品窗口
function openNocarAgentType3Div(pageIndex,obj){
	var planno = $("#planCode").val();
	if(planno==""){
		$.message("error", "请先保存投保方案");
		return;
	}
	$('#confStatus').val("ALL");
	$('#agentName').val('');
	$('#agentCode').val('');
	$("#"+obj.id).blur();
	queryNocarConfProxyInfo3(pageIndex);
}
//调用拼接参数的方法，并执行查询
function queryNocarConfProxyInfo3(pageIndex){
	var size = 10;
	var agentType = '3';
	if($.trim($('#partnerCode').val()).length==0){
		$.message("error", "请先选择合作伙伴代码");
		return;
	}
	var selectedAgentType3 = $("input[name='agentType3checkbox']:checked");
	if(selectedAgentType3.length!=0){
		var flag= false;
		selectedAgentType3.each(function(i){
			var obj=$(this).parent().parent().find("input[name='value']");
			var value= obj.val();
			var totalRate=0;
			if(value!=""){
				var reg=/^0(\.\d{0,6})?$/;
		    	var resultFlag1 = reg.test(value);
		        if(!resultFlag1){
		        	flag = true;
		        	$.message("error","手续费比例：只能录入0到1之间的有效数字(最多6位小数)");
		        	window.setTimeout(function(){ obj.focus(); }, 0);
		        	return false; 
		        }
		        totalRate=parseFloat(value);
		    }
			var obj1=$(this).parent().parent().find("input[name='marketRate']");
			var marketRate= obj1.val();
			if(marketRate!=""){
				var reg=/^0(\.\d{0,6})?$/;
		    	var resultFlag1 = reg.test(marketRate);
		        if(!resultFlag1){
		        	$.message("error","市场维护费比例：只能录入0到1之间的有效数字(最多6位小数)");
		        	flag = true;
		        	window.setTimeout(function(){ obj1.focus(); }, 0);
		        	return false; 
		        }
		        totalRate=totalRate+parseFloat(marketRate);
		    }
			var obj2=$(this).parent().parent().find("input[name='businessRate']");
			var businessRate= obj2.val();
			if(businessRate!=""){
				var reg=/^0(\.\d{0,6})?$/;
		    	var resultFlag1 = reg.test(businessRate);
		        if(!resultFlag1){
		        	$.message("error","业务绩效比例：只能录入0到1之间的有效数字(最多6位小数)");
		        	flag = true;
		        	window.setTimeout(function(){ obj2.focus(); }, 0);
		        	return false; 
		        }
		        totalRate=totalRate+parseFloat(businessRate);
		    }
			if(totalRate>=1){
				$.message("error","手续费比例、市场维护费比例、业务绩效比例之和必须小于1");
	        	flag = true;
	        	window.setTimeout(function(){ obj.focus(); }, 0);
	        	return false; 
			}
		});
		if(flag){
			return;
		}
	}
	if(selectedAgentType3.length!=0){
		selectedAgentType3.each(function(i){
			var obj = new Object();
			obj.id= $(this).parent().parent().children(" td:eq(1)").html();
			obj.cardapplicant= $(this).parent().parent().children(" td:eq(7)").html();
			obj.value= $(this).parent().parent().find("input[name='value']").val();
			obj.businessRate=$(this).parent().parent().find("input[name='businessRate']").val();
			obj.marketRate=$(this).parent().parent().find("input[name='marketRate']").val();
			map.put(obj.id,obj);
		});
	}
	var code = $('#partnerCode').val();
	var confStatus_val = $('#confStatus').val();
	var agentName_val=$('#agentName').val();
	var agentCode_val=$('#agentCode').val();
	var insuPlanNo =$("#hidepno").val();
	loadNocarConfigureInfo3({size:size,pageIndex:pageIndex,channelCode:code,agentType:agentType,confStatus:confStatus_val,userName:agentName_val,userCode:agentCode_val,insuPlanNo:insuPlanNo});
}
//配置代理信息
function loadNocarConfigureInfo3(param){
	$.openLoading();
	$.ajax({
		url : "noCarInsure/loadConfProxyInfo",
		type : 'POST',
		async : true,
		data:param,
		dataType:'json',
		success:function(partnerPage){
			$.closeLoading();
			if($.validate(partnerPage))return;

				var checkboxObj ="<input name='agentType3checkbox' type='checkbox'>";
				var fieldNames = "ID@TDH,USERCODE,USERNAME,DPTCDE,SERVICECODE,EMPNO,CARDAPPLICANT,TEAMCODE,CHANNLECODE@TDH,CHANNLECODEDES,CHANNLETYPE@TDH,CHANNLETYPEDES,NEWBSNSTYPE@TDH,NEWBSNSTYPEDES,CATEGORYCODE@TDH,CATEGORYCODEDES,AGENTNO,PROTOCOLNO";
				var inputObj = "<input style='width:100%' name='value' onchange='valueChange(this)' type='text' value=''>@<input style='width:100%' name='marketRate' onchange='valueChange(this)' type='text' value=''>@<input style='width:100%' name='businessRate' onchange='valueChange(this)' type='text' value=''>";
				var tableContent = creatTable1(fieldNames,partnerPage,checkboxObj,inputObj);
				var tableObj = $("#agentTypeDiv3Table");
				tableObj.find("tbody").remove();
				tableObj.append(tableContent);
				
				var strPage = creatChannelPage4(param.pageIndex,6,partnerPage.maxPage,"79");
				var pageDIV = $("#agentTypeDiv3Page");
				pageDIV[0].innerHTML="";
				pageDIV.append(strPage);
				
				$("#agentTypeDiv3Table").find("tr").each(function(){
					var id = $(this).children(" td:eq(1)").html();
					if(map.containsKey(id)){
						$(this).addClass("table_highlighter");
						$(this).children("td:eq(0)").find("input[name='agentType3checkbox']").prop("checked",true);
						$(this).find("input[name='value']").val(map.get(id).value);
						$(this).find("input[name='marketRate']").val(map.get(id).marketRate);
						$(this).find("input[name='businessRate']").val(map.get(id).businessRate);
					}
				});
				
				$('#agentTypeDiv3').OpenDiv();
				
				bindradio();
			}
	});
}
function valueChange(obj){
	var reg=/^0(\.\d{0,6})?$/;
	if(obj.value!=""){
    	var resultFlag1 = reg.test(obj.value);
        if(!resultFlag1){
        	$.message("error","手续费比例：只能录入0到1之间的有效数字(最多6位小数)");
        	window.setTimeout(function(){ obj.focus(); }, 0);
        	return false; 
        }
    }
}
function saveChooseNocarAgentType3(){
	var selectedAgentType3 = $("input[name='agentType3checkbox']:checked");
	if(selectedAgentType3.length!=0){
		var flag= false;
		selectedAgentType3.each(function(i){
			var totalRate=0;
			var obj=$(this).parent().parent().find("input[name='value']");
			var value= obj.val();
			if(value!=""){
				var reg=/^0(\.\d{0,6})?$/;
		    	var resultFlag1 = reg.test(value);
		        if(!resultFlag1){
		        	$.message("error","手续费比例：只能录入0到1之间的有效数字(最多6位小数)");
		        	flag = true;
		        	window.setTimeout(function(){ obj.focus(); }, 0);
		        	return false; 
		        }
		        totalRate=parseFloat(value);
		    }
			var obj1=$(this).parent().parent().find("input[name='marketRate']");
			var marketRate= obj1.val();
			if(marketRate!=""){
				var reg=/^0(\.\d{0,6})?$/;
		    	var resultFlag1 = reg.test(marketRate);
		        if(!resultFlag1){
		        	$.message("error","市场维护费比例：只能录入0到1之间的有效数字(最多6位小数)");
		        	flag = true;
		        	window.setTimeout(function(){ obj1.focus(); }, 0);
		        	return false; 
		        }
		        totalRate=totalRate+parseFloat(marketRate);
		    }
			var obj2=$(this).parent().parent().find("input[name='businessRate']");
			var businessRate= obj2.val();
			if(businessRate!=""){
				var reg=/^0(\.\d{0,6})?$/;
		    	var resultFlag1 = reg.test(businessRate);
		        if(!resultFlag1){
		        	$.message("error","业务绩效比例：只能录入0到1之间的有效数字(最多6位小数)");
		        	flag = true;
		        	window.setTimeout(function(){ obj2.focus(); }, 0);
		        	return false; 
		        }
		        totalRate=totalRate+parseFloat(businessRate);
		    }
			if(totalRate>=1){
				$.message("error","手续费比例、市场维护费比例、业务绩效比例之和必须小于1");
	        	flag = true;
	        	window.setTimeout(function(){ obj.focus(); }, 0);
	        	return false; 
			}
		});
		if(flag){
			return;
		}
	}
	if(selectedAgentType3.length!=0){
		selectedAgentType3.each(function(i){
			var obj = new Object();
			obj.id= $(this).parent().parent().children(" td:eq(1)").html();
			obj.cardapplicant= $(this).parent().parent().children(" td:eq(7)").html();
			obj.value= $(this).parent().parent().find("input[name='value']").val();
			obj.businessRate=$(this).parent().parent().find("input[name='businessRate']").val();
			obj.marketRate=$(this).parent().parent().find("input[name='marketRate']").val();
			map.put(obj.id,obj);
		});
	}
	var planno = $("#planCode").val();
	
	if(map.isEmpty()){
		$.message("error", "请选择销售业务信息");
		return;
	}else{
		var isPrintCard_val = $.trim($('#isPrintCard').val());
		agentTypeList = new Array();
		for(i in map.keys()){
	        var key = map.keys()[i];
	        if('Y'==isPrintCard_val){
	        	if(''==map.get(key).cardapplicant){
		        	$.message("error", "该方案为打印单证,您选择的销售业务信息中存在单证领用人为空的,请调整后添加");
		    		return;
		        }
	        }
	        agentTypeList.push(map.get(key));
	    }
		mapBak.clear();
		for(i in map.keys()){
	        var key = map.keys()[i];
	        mapBak.put(key,map.get(key));
	    }
		agentTypeListStr=JSON.stringify(agentTypeList);
	}
	
	updateProxyInfo({insuPlanNo:planno,agentTypeList:agentTypeListStr});
	
	closeCurrentDIV('agentTypeDiv3');
}
//执行更新
function updateProxyInfo(param){
	$.openLoading();
	$.ajax({
		url : "noCarInsure/updateProxyInfo",
		type : 'POST',
		async : true,
		data:param,
		dataType:'json',
		success:function(data){
			$.closeLoading();
			if($.validate(data))return;
			var planno = $("#planCode").val();
			var agentType_val= $("#agentType").val();
			if(agentType_val=="3"){
				queryNocarConfProxyInfoEdit3(1);
			}
			if(agentType_val=="4"){
				queryNocarConfProxyInfoEdit4(1);
			}
		}
	});
}



function openNocarAgentType4Div(pageIndex,obj){
	var planno = $("#planCode").val();
	if(planno==""){
		$.message("error", "请先保存投保方案");
		return;
	}
	$('#confStatus4').val("ALL");
	$('#branch').val('');
	$('#branchName').val('');

	$("#"+obj.id).blur();
	queryNocarConfProxyInfo4(pageIndex);
}
function queryNocarConfProxyInfo4(pageIndex){
	var size = 10;
	var agentType = '4';
	if($.trim($('#partnerCode').val()).length==0){
		$.message("error", "请先选择合作伙伴代码");
		return;
	}
	var selectedAgentType4 = $("input[name='agentType4checkbox']:checked");
	if(selectedAgentType4.length!=0){
		var flag= false;
		selectedAgentType4.each(function(i){
			var obj=$(this).parent().parent().find("input[name='value']");
			var value= obj.val();
			var totalRate=0;
			if(value!=""){
				var reg=/^0(\.\d{0,6})?$/;
		    	var resultFlag1 = reg.test(value);
		        if(!resultFlag1){
		        	$.message("error","手续费比例：只能录入0到1之间的有效数字(最多6位小数)");
		        	flag = true;
		        	window.setTimeout(function(){ obj.focus(); }, 0);
		        	return false; 
		        }
		        totalRate=parseFloat(value);
		    }
			var obj1=$(this).parent().parent().find("input[name='marketRate']");
			var marketRate= obj1.val();
			if(marketRate!=""){
				var reg=/^0(\.\d{0,6})?$/;
		    	var resultFlag1 = reg.test(marketRate);
		        if(!resultFlag1){
		        	$.message("error","市场维护费比例：只能录入0到1之间的有效数字(最多6位小数)");
		        	flag = true;
		        	window.setTimeout(function(){ obj1.focus(); }, 0);
		        	return false; 
		        }
		        totalRate=totalRate+parseFloat(marketRate);
		    }
			var obj2=$(this).parent().parent().find("input[name='businessRate']");
			var businessRate= obj2.val();
			if(businessRate!=""){
				var reg=/^0(\.\d{0,6})?$/;
		    	var resultFlag1 = reg.test(businessRate);
		        if(!resultFlag1){
		        	$.message("error","业务绩效比例：只能录入0到1之间的有效数字(最多6位小数)");
		        	flag = true;
		        	window.setTimeout(function(){ obj2.focus(); }, 0);
		        	return false; 
		        }
		        totalRate=totalRate+parseFloat(businessRate);
		    }
			if(totalRate>=1){
				$.message("error","手续费比例、市场维护费比例、业务绩效比例之和必须小于1");
	        	flag = true;
	        	window.setTimeout(function(){ obj.focus(); }, 0);
	        	return false; 
			}
		});
		if(flag){
			return;
		}
	}
	if(selectedAgentType4.length!=0){
		selectedAgentType4.each(function(i){
			var obj = new Object();
			obj.id= $(this).parent().parent().children(" td:eq(1)").html();
		    var columnes=$("#agentTypeDiv4Table").find("th").length;
		    if(columnes==16){
				obj.cardapplicant= $(this).parent().parent().children(" td:eq(10)").html();
		    }else if(columnes==18){
				obj.cardapplicant= $(this).parent().parent().children(" td:eq(12)").html();
		    }
		
			obj.value= $(this).parent().parent().find("input[name='value']").val();
			obj.businessRate=$(this).parent().parent().find("input[name='businessRate']").val();
			obj.marketRate=$(this).parent().parent().find("input[name='marketRate']").val();
			map.put(obj.id,obj);
		});
	}
	var code = $('#partnerCode').val();
	var confStatus_val = $('#confStatus4').val();
	var branch_val=$('#branch').val();
	var branchName_val=$('#branchName').val();
	var insuPlanNo =$("#hidepno").val();
	loadNocarConfigureInfo4({size:size,pageIndex:pageIndex,channelCode:code,agentType:agentType,confStatus:confStatus_val,insuPlanNo:insuPlanNo,branch:branch_val,branchName:branchName_val});
}

function loadNocarConfigureInfo4(param){
	$.openLoading();
	$.ajax({
		url : "noCarInsure/loadConfProxyInfo",
		type : 'POST',
		async : true,
		data:param,
		dataType:'json',
		success:function(partnerPage){
			$.closeLoading();
			var flang = false; 
			var fieldNames ;
			if($.validate(partnerPage))return;
				$.each(partnerPage.data, function(k, v){
				 if(v.TRANSTYPE=='1'){
					 flang=true;
				 }
				 return false; 
				});
				var columnes=$("#agentTypeDiv4Table").find("th").length;
				var checkboxObj ="<input name='agentType4checkbox' type='checkbox'>";
				if(flang){
					 fieldNames = "ID@TDH,CHANNELCODE@TDH,SUBCHANNELCODE@TDH,BRANCH,BRANCHNAME,USERCODE,USERNAME,ZONE,DPTCDE,SERVICECODE,EMPNO,CARDAPPLICANT,TEAMCODE,CHANNLECODE@TDH,CHANNLECODEDES,CHANNLETYPE@TDH,CHANNLETYPEDES,NEWBSNSTYPE@TDH,NEWBSNSTYPEDES,CATEGORYCODE@TDH,CATEGORYCODEDES,AGENTNO,PROTOCOLNO,COMMRATE";
				}else{
					 //先判断是否删除表头
					 if(columnes == 20){
						 $("#agentTypeDiv4Table tr th:eq(3)").remove();
						 $("#agentTypeDiv4Table tr th:eq(3)").remove(); 
					 }
					 fieldNames = "ID@TDH,CHANNELCODE@TDH,SUBCHANNELCODE@TDH,BRANCH,BRANCHNAME,ZONE,DPTCDE,SERVICECODE,EMPNO,CARDAPPLICANT,TEAMCODE,CHANNLECODE@TDH,CHANNLECODEDES,CHANNLETYPE@TDH,CHANNLETYPEDES,NEWBSNSTYPE@TDH,NEWBSNSTYPEDES,CATEGORYCODE@TDH,CATEGORYCODEDES,AGENTNO,PROTOCOLNO,COMMRATE";
				}
				var inputObj ="<input style='width:100%' name='value' onchange='valueChange(this)' type='text' value=''>@<input style='width:100%' name='marketRate' onchange='valueChange(this)' type='text' value=''>@<input style='width:100%' name='businessRate' onchange='valueChange(this)' type='text' value=''>";
				var tableContent = creatTable1(fieldNames,partnerPage,checkboxObj,inputObj);
				var tableObj = $("#agentTypeDiv4Table");
				tableObj.find("tbody").remove();
				tableObj.append(tableContent);
				
				var strPage = creatChannelPage4(param.pageIndex,6,partnerPage.maxPage,"36");
				var pageDIV = $("#agentTypeDiv4Page");
				pageDIV[0].innerHTML="";
				pageDIV.append(strPage);
				
				$("#agentTypeDiv4Table").find("tr").each(function(){
					var id = $(this).children(" td:eq(1)").html();
					if(map.containsKey(id)){
						$(this).addClass("table_highlighter");
						$(this).children("td:eq(0)").find("input[name='agentType4checkbox']").prop("checked",true);
						$(this).find("input[name='value']").val(map.get(id).value);
						$(this).find("input[name='marketRate']").val(map.get(id).marketRate);
						$(this).find("input[name='businessRate']").val(map.get(id).businessRate);
					}
				});
				
				$('#agentTypeDiv4').OpenDiv();
				
				bindradio();
			}
	});
}
function saveChooseNocarAgentType4(){
	var selectedAgentType4 = $("input[name='agentType4checkbox']:checked");
	if(selectedAgentType4.length!=0){
		var flag= false;
		selectedAgentType4.each(function(i){
			var obj=$(this).parent().parent().find("input[name='value']");
			var value= obj.val();
			var totalRate=0;
			if(value!=""){
				var reg=/^0(\.\d{0,6})?$/;
		    	var resultFlag1 = reg.test(value);
		        if(!resultFlag1){
		        	$.message("error","手续费比例：只能录入0到1之间的有效数字(最多6位小数)");
		        	flag = true;
		        	window.setTimeout(function(){ obj.focus(); }, 0);
		        	return false; 
		        }
		        totalRate=parseFloat(value);
		    }
			var obj1=$(this).parent().parent().find("input[name='marketRate']");
			var marketRate= obj1.val();
			if(marketRate!=""){
				var reg=/^0(\.\d{0,6})?$/;
		    	var resultFlag1 = reg.test(marketRate);
		        if(!resultFlag1){
		        	$.message("error","市场维护费比例：只能录入0到1之间的有效数字(最多6位小数)");
		        	flag = true;
		        	window.setTimeout(function(){ obj1.focus(); }, 0);
		        	return false; 
		        }
		        totalRate=totalRate+parseFloat(marketRate);
		    }
			var obj2=$(this).parent().parent().find("input[name='businessRate']");
			var businessRate= obj2.val();
			if(businessRate!=""){
				var reg=/^0(\.\d{0,6})?$/;
		    	var resultFlag1 = reg.test(businessRate);
		        if(!resultFlag1){
		        	$.message("error","业务绩效比例：只能录入0到1之间的有效数字(最多6位小数)");
		        	flag = true;
		        	window.setTimeout(function(){ obj2.focus(); }, 0);
		        	return false; 
		        }
		        totalRate=totalRate+parseFloat(businessRate);
		    }
			if(totalRate>=1){
				$.message("error","手续费比例、市场维护费比例、业务绩效比例之和必须小于1");
	        	flag = true;
	        	window.setTimeout(function(){ obj.focus(); }, 0);
	        	return false; 
			}
		});
		if(flag){
			return;
		}
	}
	if(selectedAgentType4.length!=0){
		selectedAgentType4.each(function(i){
			var obj = new Object();
			obj.id= $(this).parent().parent().children(" td:eq(1)").html();
			  var columnes=$("#agentTypeDiv4Table").find("th").length;
			    if(columnes==18){
					obj.cardapplicant= $(this).parent().parent().children(" td:eq(10)").html();
			    }else if(columnes==20){
			    	obj.cardapplicant= $(this).parent().parent().children(" td:eq(12)").html();			
			    }
			obj.value= $(this).parent().parent().find("input[name='value']").val();
			obj.businessRate=$(this).parent().parent().find("input[name='businessRate']").val();
			obj.marketRate=$(this).parent().parent().find("input[name='marketRate']").val();
			map.put(obj.id,obj);
		});
	}
	var planno = $("#planCode").val();
	
	if(map.isEmpty()){
		$.message("error", "请选择销售业务信息");
		return;
	}else{
		var isPrintCard_val = $.trim($('#isPrintCard').val());
		agentTypeList = new Array();
		for(i in map.keys()){
	        var key = map.keys()[i];
	        if('Y'== isPrintCard_val){
	        	if(''== map.get(key).cardapplicant){
		        	$.message("error", "该方案为打印单证,您选择的销售业务信息中存在单证领用人为空的,请调整后添加");
		    		return;
		        }
	        }
	        agentTypeList.push(map.get(key));
	    }
		mapBak.clear();
		for(i in map.keys()){
	        var key = map.keys()[i];
	        mapBak.put(key,map.get(key));
	    }
		agentTypeListStr=JSON.stringify(agentTypeList);
	}
	
	updateProxyInfo({insuPlanNo:planno,agentTypeList:agentTypeListStr});
	
	closeCurrentDIV('agentTypeDiv4');
}

//----编辑页面的查询
function queryNocarConfProxyInfoEdit3(pageIndex){
	var size = 5;
	var insplanno = $('#hidepno').val();
	var agentType ="3";
	loadNocarConfigureInfoEdit3({size:size,pageIndex:pageIndex,insuPlanNo:insplanno,agentType:agentType});
}
function loadNocarConfigureInfoEdit3(param){
	$.ajax({
		url : "noCarInsure/loadConfProxyInfoEdit",
		type : 'POST',
		async : true,
		data:param,
		dataType:'json',
		success:function(partnerPage){
			$.closeLoading();
			if($.validate(partnerPage))return;

				var fieldNames = "USERCODE,USERNAME,DPTCDE,SERVICECODE,EMPNO,CARDAPPLICANT,TEAMCODE,CHANNLECODE@TDH,CHANNLECODEDES,CHANNLETYPE@TDH,CHANNLETYPEDES,NEWBSNSTYPE@TDH,NEWBSNSTYPEDES,CATEGORYCODE@TDH,CATEGORYCODEDES,AGENTNO,PROTOCOLNO,COMMRATE,MARKETRATE,BUSRATE";
				var tableContent = creatTable1(fieldNames,partnerPage);
				var tableObj = $("#agentType3Table");
				tableObj.find("tbody").remove();
				tableObj.append(tableContent);
				
				var strPage = creatChannelPage3(param.pageIndex,6,partnerPage.maxPage,"35");
				var pageDIV = $("#agentType3TablePageDIV");
				pageDIV[0].innerHTML="";
				pageDIV.append(strPage);
				
			}
	});
}
function queryNocarConfProxyInfoEdit4(pageIndex){
	var size = 5;
	var insplanno = $('#hidepno').val();
	var agentType ="4";
	loadNocarConfigureInfoEdit4({size:size,pageIndex:pageIndex,insuPlanNo:insplanno,agentType:agentType});
}
function loadNocarConfigureInfoEdit4(param){
	$.ajax({
		url : "noCarInsure/loadConfProxyInfoEdit",
		type : 'POST',
		async : true,
		data:param,
		dataType:'json',
		success:function(partnerPage){
			$.closeLoading();
			var flang=false;
			var fieldNames ;
			if($.validate(partnerPage))return;
			$.each(partnerPage.data, function(k, v){
			 if(v.TRANSTYPE=='1'){
				 flang=true;
			 }
			 return false; 
			});
			var columnes=$("#agentType4Table").find("th").length;
			if(flang){
				fieldNames= "BRANCH,BRANCHNAME,USERCODE,USERNAME,ZONE,DPTCDE,SERVICECODE,EMPNO,CARDAPPLICANT,TEAMCODE,CHANNLECODE@TDH,CHANNLECODEDES,CHANNLETYPE@TDH,CHANNLETYPEDES,NEWBSNSTYPE@TDH,NEWBSNSTYPEDES,CATEGORYCODE@TDH,CATEGORYCODEDES,AGENTNO,PROTOCOLNO,COMMRATE,MARKETRATE,BUSRATE";
				$("#agentType4Table tr:eq(1) td:eq(0)").attr("colspan",17).siblings().remove();
			}else{
			    //先判断是否删除表头
			    	if(columnes == 19){
			    		$("#agentType4Table tr th:eq(2)").remove();
						$("#agentType4Table tr th:eq(2)").remove();
			    	}
				 	fieldNames = "BRANCH,BRANCHNAME,ZONE,DPTCDE,SERVICECODE,EMPNO,CARDAPPLICANT,TEAMCODE,CHANNLECODE@TDH,CHANNLECODEDES,CHANNLETYPE@TDH,CHANNLETYPEDES,NEWBSNSTYPE@TDH,NEWBSNSTYPEDES,CATEGORYCODE@TDH,CATEGORYCODEDES,AGENTNO,PROTOCOLNO,COMMRATE,MARKETRATE,BUSRATE";
				 	 $("#agentType4Table tr:eq(1) td:eq(0)").attr("colspan",17).siblings().remove();
			}
				var tableContent = creatTable1(fieldNames,partnerPage);
				var tableObj = $("#agentType4Table");
				tableObj.find("tbody").remove();
				tableObj.append(tableContent);
				
				var strPage = creatChannelPage3(param.pageIndex,6,partnerPage.maxPage,"37");
				var pageDIV = $("#agentType4TablePageDIV");
				pageDIV[0].innerHTML="";
				pageDIV.append(strPage);
				
			}
	});
}
//------------------------------------------配置代理信息结束-------------------------------------------
//------------------------------------------与销管联调开始-------------------------------------------
//获取业务员信息及业务员所在团队信息
 	var team_user_list;//存放销管返回的业务员及团队信息的List,便于业务员代码改变时，业务员名称和团队列表的同步改变
	function querySauserAndTeamInfo(){
 		var dptCde = $.trim($('#deptCode').val());
 		
		//必须先选择出单机构，再获取
		if(dptCde.length==0){
			$.message('error',"请先选择出单机构");
			return;
		}
 		
		$.openLoading();
		$.ajax({
			url : "<%=path%>/noCarInsure/querySauserAndTeamInfo?"+new Date().getTime(),
			type : 'POST',
			async : true,
			data:{
				COMCODE:dptCde
			},
			dataType:'json',
			success:function(result){
				$.closeLoading();
				if("error"==result.result){
					$.message('error',"该机构下未查询到对应业务员及团队信息");
					return;
				}
				
				var select = document.getElementById("empNo_select");
				select.options.length = 0;
				select.add(new Option("-----请选择-----",""));
				team_user_list = result.data;
				var empNo = $.trim($("#empNo").val());
				for (var i = 0; i < team_user_list.length; i++) {
					var option = new Option();
					option.text = team_user_list[i].USERCODE + "-" + team_user_list[i].USERNAME;
					option.title = team_user_list[i].USERCODE + "-" + team_user_list[i].USERNAME;
					option.value = team_user_list[i].USERCODE;
					if(empNo==team_user_list[i].USERCODE){
						option.selected=true;	
						$("#empName").val(team_user_list[i].USERNAME);
						$('#empNo_select_div').css('display','inline').val("");
						$('#empNo').hide().val(team_user_list[i].USERCODE);
					}else if(empNo.length<1 || empNo != team_user_list[i].USERCODE){
						$('#empNo_select_div').css('display','inline').val("");
						$('#empNo').hide().val('');
					}
					select.add(option);
				}
			}
		});
	}
 	
	//业务员下拉框改变时，动态改变业务员名称和团队代码
 	var TEAMList;//存放当前所选业务员对应的团队List，便于团队代码改变时，团队名称的同步改变
 	function changeEmpNo(){
 		var empNo_select = $.trim($("#empNo_select").val());
		if (empNo_select.length > 10) {
			$.message('error', "业务员代码长度不能超过10位！");
			return;
		}
 		$("#empNo").val(empNo_select);
 		
 		if(empNo_select.length==0) {
 			$("#empName").val("");
 			/*teamInfoWrite();
 			agentInfoWrite();
 			serviceInfoWrite();*/
 			return;
 		}	
 		
 		for (var i = 0; i < team_user_list.length; i++) {
			var USERCODE = team_user_list[i].USERCODE;
			if(empNo_select == USERCODE){
				$("#empName").val(team_user_list[i].USERNAME);
				
				TEAMList = team_user_list[i].TEAMList;
				var select = document.getElementById("teamCode_select");
				select.options.length = 0;
				select.add(new Option("-----请选择-----",""));
				for (var j = 0; j < TEAMList.length; j++) {
					var option = new Option();
					option.text = TEAMList[j].TEAMCODE + "-" + TEAMList[j].TEAMNAME;
					option.title = TEAMList[j].TEAMCODE + "-" + TEAMList[j].TEAMNAME;
					option.value = TEAMList[j].TEAMCODE;
					select.add(option);
				}
				teamInfoSelect();
			//	queryServiceNo();
				return;
			}
		}
 	}
	
 	//团队代码改变时，动态改变团队名称
 	function changeTeamCode(){
 		var teamCode_select = $.trim($("#teamCode_select").val());
		if (teamCode_select.length > 11) {
			$.message('error', "团队代码长度不能超过11位！");
			return;
		}
 		$("#teamCode").val(teamCode_select);
 		
 		if(teamCode_select.length==0) {
 			$("#teamName").val("");
 		/*	agentInfoWrite();
 			serviceInfoWrite();*/
 			return;
 		}
 		
 		for (var i = 0; i < TEAMList.length; i++) {
 			var TEAMCODE = TEAMList[i].TEAMCODE;
 			if(teamCode_select == TEAMCODE){
 				$("#teamName").val(TEAMList[i].TEAMNAME);
				$('#channelCodeQD').val(TEAMList[i].CHANNELNAME);
				$('#channelCodeQD').change();
 			}
 			//queryAgentAndAgreeInfo();
 		}
		var newBsnsType = $.trim($("#newBsnsType").val());
		if(newBsnsType.length==0){$.message('error',"请选择业务来源");return;}
 	}
 	
 	//查询中介-协议信息
 	var agent_agreement_list;//存放销管返回的代理人代码和协议号的List,便于代理人代码改变时，协议号的同步改变
	function queryAgentAndAgreeInfo(){
 		var prodCode = $.trim($('#prodCode').val());
 		var dptCde = $.trim($('#deptCode').val());
 		var channelCodeQD = $.trim($('#channelCodeQD').val());
 		var newBsnsType =$.trim($('#newBsnsType').val());
 		var teamCode = $.trim($('#teamCode').val());
		//必须先选择产品出单机构、归属渠道、业务来源，团队代码，再获取
		if(prodCode.length==0){$.message('error',"请先选择产品");return;}
		if(dptCde.length==0){$.message('error',"请先选择出单机构");return;}
		if(channelCodeQD.length==0){$.message('error',"请先选择归属渠道");return;}
		if(newBsnsType.length==0){$.message('error',"请先选择业务来源");return;}
		if(teamCode.length==0){$.message('error',"请先选择团队代码");return;}

		$.openLoading();
		$.ajax({
			url : "<%=path%>/noCarInsure/queryAgentAndAgreeInfo?"+new Date().getTime(),
			type : 'POST',
			async : true,
			data:{
				COMCODE:dptCde,
				TEAMCODE:teamCode,
				BUSINESSSOURCE:newBsnsType,
				CHANNELNAME:channelCodeQD,
				PRODCODE:prodCode
			},
			dataType:'json',
			success:function(result){
				var select = document.getElementById("agentNo_select");
				select.options.length = 0;
				$.closeLoading();
				if("success"!=result.result) {
					$.message('error',"未查询到对应代理信息");
					$('#agentNo').attr("readonly",true).css("background-color","#ccc").val('');
					$('#protocolNo').attr("readonly",true).css("background-color","#ccc").val('');
					$('#agentName').attr("readonly",true).css("background-color","#ccc").val('');
				//	agentInfoWrite();
					return;
				}
				
				var select = document.getElementById("agentNo_select");
				select.options.length = 0;
				select.add(new Option("-----请选择-----",""));
				agent_agreement_list = result.data;
				for (var i = 0; i < agent_agreement_list.length; i++) {
					var option = new Option();
					option.text = agent_agreement_list[i].AGENTCODE;
					option.title = agent_agreement_list[i].AGENTCODE;
					option.value = agent_agreement_list[i].AGENTCODE;
					select.add(option);
				}
				agentInfoSelect();
			}
		});
	}
 	
	//代理人代码改变时，同步改变协议号
	function changeAgentNo(){
		var agentNo_select = $.trim($("#agentNo_select").val());
 		$("#agentNo").val(agentNo_select);
 		
 		if(agentNo_select.length==0){
 			$("#protocolNo").val("");
 		//	serviceInfoWrite();
 			$("#commRateSpan").empty();
 			return;
 		}
 		
 		for (var i = 0; i < agent_agreement_list.length; i++) {
 			var AGENTCODE = agent_agreement_list[i].AGENTCODE;
			if(agentNo_select == AGENTCODE){
				if (agent_agreement_list[i].AGREEMENTNO.length > 13) {
					$.message('error', "代理协议号长度不能超过13位！");
					return;
				}
				$("#protocolNo").val(agent_agreement_list[i].AGREEMENTNO);
				$("#feeMaxRate").val(agent_agreement_list[i].FEEMAXRATE);
				$("#feeMinRate").val(agent_agreement_list[i].FEEMINRATE);
				
				$('#commRateSpan').html("上限:"+agent_agreement_list[i].FEEMAXRATE+",下限:"+agent_agreement_list[i].FEEMINRATE);
				break;
			}
 		}
		queryServiceNo();
	}
	
	//查询服务代码信息
	var servicenos_list;//存放销管返回的服务代码和服务名称的List,便于服务代码改变时，服务名称的同步改变
	function queryServiceNo(){
 		var dptCde = $.trim($('#deptCode').val());
 		var channelCodeQD = $.trim($('#channelCodeQD').val());
 		var newBsnsType = $.trim($('#newBsnsType').val());
 		var empNo = $.trim($('#empNo').val());
 		var agentNo = $.trim($('#agentNo').val());
		//必须先选择产品出单机构、归属渠道、业务来源、业务员代码、代理人代码，再获取
		if(dptCde.length==0){$.message('error',"请先选择出单机构");return;}
		if(channelCodeQD.length==0){$.message('error',"请先选择归属渠道");return;}
		if(newBsnsType.length==0){$.message('error',"请先选择业务来源");return;}
		if(empNo.length==0){$.message('error',"请先选择业务员代码");return;}
		
		$.openLoading();
		$.ajax({
			url : "<%=path%>/noCarInsure/queryServiceNo?"+new Date().getTime(),
			type : 'POST',
			async : true,
			data:{
				COMCODE:dptCde,
				BUSINESSSOURCE:newBsnsType,
				CHANNELNAME:channelCodeQD,
				USERCODE:empNo,
				AGENTCODE:agentNo
			},
			dataType:'json',
			success:function(result){
				$.closeLoading();
				if("success"!=result.result) {
					$.message('error',"未查询到对应服务代码");
					return;
				}
				
				var select = document.getElementById("serviceCode_select");
				select.options.length = 0;
				select.add(new Option("-----请选择-----",""));
				servicenos_list = result.data;
				for (var i = 0; i < servicenos_list.length; i++) {
					var option = new Option();
					option.text = servicenos_list[i].SERVICENO + "-" + servicenos_list[i].SERVICENAME;
					option.title = servicenos_list[i].SERVICENO + "-" + servicenos_list[i].SERVICENAME;
					option.value = servicenos_list[i].SERVICENO;
					select.add(option);
				}
				serviceInfoSelect();
			}
		});
	}
	
	//服务代码改变时，同步改变服务名称
	function changeServiceCode(){
		var serviceCode_select = $.trim($("#serviceCode_select").val());
 		$("#serviceCode").val(serviceCode_select);
 		
 		if(serviceCode_select.length==0) {
 			$("#serviceName").val("");
 			return;
 		}
 		
 		for (var i = 0; i < servicenos_list.length; i++) {
 			var SERVICENO = servicenos_list[i].SERVICENO;
			if(serviceCode_select == SERVICENO){
				$("#serviceName").val(servicenos_list[i].SERVICENAME);
			}
 		}
	}
	
	//业务员代码、业务员名称可输入状态
	function empInfoWrite(){
		$('#empNo_select_div').css('display','none').val("");
		$('#empNo').show().attr("readonly",true).css('background-color','#ccc').val('');
		$('#empName').attr("readonly",true).css('background-color','#ccc').val('');
	}
	//业务员代码可选状态
	function empInfoSelect(){
		$('#empNo_select_div').css('display','inline').val("");
		$('#empNo').hide().val('');
		$('#empName').attr("readonly",true).css('background-color','#ccc').val("");
	}
	
	//团队代码、团队名称可输入状态
	function teamInfoWrite(){
		$('#teamCode_select_div').css('display','none').val("");
		$('#teamCode').show().val('');
		$('#teamName').attr("readonly",false).css('background-color','white').val('');
	}
	//团队代码可选状态
	function teamInfoSelect(){
		$('#teamCode_select_div').css('display','inline').val("");
		$('#teamCode').hide().val('');
		$('#teamName').attr("readonly",true).css('background-color','#ccc').val("");
	}
	
	//代理人代码、代理协议号可输入状态
	function agentInfoWrite(){
		$('#agentNo_select_div').css('display','none').val("");
		$('#agentNo').show().attr("readonly",true).css('background-color','#ccc').val('');
		$('#protocolNo').attr("readonly",true).css('background-color','#ccc').val('');
		$('#agentName').attr("readonly",true).css('background-color','#ccc').val('');
		$("#commRateSpan").empty();
		$('#feeMinRate').val("0");
		$('#feeMaxRate').val('1');
	}
	//代理人代码可选状态
	function agentInfoSelect(){
		$('#agentNo_select_div').css('display','inline').val("");
		$('#agentNo').hide().val('');
		$('#protocolNo').attr("readonly",true).css('background-color','#ccc').val("");
		$("#commRateSpan").empty();
		$('#feeMinRate').val("0");
		$('#feeMaxRate').val('1');
	}
	
	//服务代码、服务名称可输入状态
	function serviceInfoWrite(){
		$('#serviceCode_select_div').css('display','none').val("");
		$('#serviceCode').show().val('');
		$('#serviceName').attr("readonly",true).css('background-color','#ccc').val('');
	}
	//服务代码可选状态
	function serviceInfoSelect(){
		$('#serviceCode_select_div').css('display','inline').val("");
		$('#serviceCode').hide().val('');
		$('#serviceName').attr("readonly",true).css('background-color','#ccc').val("");
	}
	function CheckedSendMail(){
		var ChecdedMail=$("#isEpolicyMali").val();
		if(ChecdedMail==1){
			emailTemplate();
			$("#MailTemplateTr").show();
			$('#MailTemplate').html("");
			$("#sendAccessory").show();
			$("#sendAccessoryTd").show();
			$('#SendAccessoryBox').show();
			setEmailTemplate();
		}else{
			$("#MailTemplateTr").hide();
			$("#sendAccessory").hide();
			$("#sendAccessoryTd").hide();
		}
	}
	
	function SeeMoneyChange(){
		var isSeeMoney =$('#isSeeMoney').val();
		if(isSeeMoney=="N"){
			$('#isDredgePay').val(1);
			$('#isDredgePay').attr("disabled",true);
			$("#isDredgePay").css({"background-color": "#ccc"});
			setEmailTemplate();
		}else{
			$("#isDredgePay").attr("disabled",false);
			$("#isDredgePay").css({"background-color": ""});
		}
	}
	
	var rolemap=new Map();
	//销售人员信息
	function opensaleDiv(){
		if(!rolemap.get("saleMenTypes")){
			$.ajax({
				url : "<%=path%>/noCarInsure/loadDic",
				type : 'POST',
				async : true,
				data:{},
				dataType:'json',
				success:function(data){
					rolemap.put("saleMenTypes", data.saleMenTypes);
					rolemap.put("saleTypes", data.saleTypes);
					createSale();
				}
			});
		}else {
			createSale();
		}
	}
	function getSale(i){
		var roles=rolemap.get("saleMenTypes");
		var hr='<select id="saleMentype'+i+'" class="select_1 valid" style=" width: 130px">'
				+'<option value="0">请选择</option>'
			for (var j = 0; j < roles.length; j++) {
				hr+='<option value="'+roles[j].code+'">'+roles[j].codeName+'</option>'
			}
			hr+='</select>';
		return hr;
	}
	function getSale1(i){
		var roles=rolemap.get("saleTypes");
		var hr='<select id="saletype'+i+'" class="select_1 valid" style=" width: 130px">'
				+'<option value="0">请选择</option>'
			for (var j = 0; j < roles.length; j++) {
				hr+='<option value="'+roles[j].code+'">'+roles[j].codeName+'</option>'
			}
			hr+='</select>';
		return hr;
	}
	function createSale(){
		var salecontent=''
			for (var i = 1; i <= 5; i++) {
				salecontent+='<tr>'+
				'<td>'+i+'<input type="hidden" id="flag'+i+'" value="'+i+'"/></td>'+
				'<td>'+
					getSale1(i)+
				'</td>'+
				'<td><input type="text" onkeyup="clearNoNum(event,this)"  id="saleRate'+i+'" style=" width: 130px"/></td>'+							
				'<td><input type="text" id="saleCallNo'+i+'"  class="input_text" style=" width: 130px"/></td>'+								
				'<td>'+
					getSale(i)+
					'</select>'+
				'</td>'+
				'<td><input type="text" id="saleMen'+i+'"  class="input_text" style=" width: 130px"/></td>'+								
				'<td><input type="text" id="empNo'+i+'"  class="input_text" style=" width: 130px"/></td>'+							
				'<td><input type="text" id="agentNo'+i+'"  class="input_text" style=" width: 130px"/></td>'+								
			'</tr>'
			}
			$('#salecontent').html('');
			$('#salecontent').html(salecontent);
			$('#sale_div').OpenDiv()
			//赋值
			for (var i = 1; i <=5; i++) {
			var o=salemap.get(i);
			if(o){
				 $('#flag'+i).val(o.seqNo);
				 $('#saletype'+i).val(o.saleType);
				 $('#saleRate'+i).val(o.agentFee);
				 $('#saleCallNo'+i).val(o.practiceNo);
				 $('#saleMentype'+i).val(o.personType);
				 $('#saleMen'+i).val(o.salePerson);
				 $('#empNo'+i).val(o.empNo);
				 $('#agentNo'+i).val(o.agentNo)
			}
		}
	}
	
	function inputBtn(){
		/*empInfoWrite();
		teamInfoWrite();
		agentInfoWrite();
		serviceInfoWrite();*/
	}
	function emailTemplate(){
		$.ajax({
			url : "<%=path%>/noCarInsure/queryEmailTempList?"+new Date().getTime(),
			type : 'POST',
			async : false,
			data:{},
			dataType:'json',
			success:function(data){
				var templates=data.templates;
				if(templates){
					for (var i = 0; i < templates.length; i++) {
						emailMap.put(templates[i].selKey,templates[i].emailTemplate);						
					}
				}

			}
		});
	}
	//动态设置邮件模板
	function setEmailTemplate(flag){
		if(flag=='1'){
			return;
		}
		if(emailMap.elements.length==0){
			emailTemplate();
		}
		var selKey='';
		var isEpolicy=$("#isEpolicy").val();
		var DownloadWay=$("#DownloadWay").val();
		var fileType=$("#fileType").val();
		var isEpolicyInvoice=$("#isEpolicyInvoice").val();
		selKey=isEpolicy;
		if(isEpolicy=='Y'){
			selKey=selKey+'-'+DownloadWay;
		}else{
			selKey=selKey+'-';
		}
		if(isEpolicy=='Y'&&DownloadWay=='1'){
			selKey=selKey+'-'+fileType;
		}else{
			selKey=selKey+'-';
		}
		selKey=selKey+'-'+isEpolicyInvoice;
		var invockLink=$('#invockLink').val();
		if(isEpolicyInvoice=='1'&&invockLink!='S'){
			selKey=selKey+'-'+invockLink;
		}else{
			selKey=selKey+'-';
		}
		var selectAccessorys=$('input[name=SendAccessoryBox]').get(0);
		if(isEpolicy=='Y'){
			if(selectAccessorys.checked){
				selKey=selKey+'-'+'Y';
			}else{
				selKey=selKey+'-'+'N';
			}
		}else{
			selKey=selKey+'-';
		}
		if(emailMap.get(selKey)){
			var emailTemplate = emailMap.get(selKey);
			if(isEpolicy == 'Y'){
				emailTemplate = emailTemplate.replace("#ePolicyUrl#",'<a href="#ePolicyUrl#">#ePolicyUrl#</a>')
			}
			if (isEpolicyInvoice == '1'){
				emailTemplate = emailTemplate.replace("#eInvoiceUrl#",'<a href="#eInvoiceUrl#">#eInvoiceUrl#</a>')
			}
			$('#MailTemplate').val(emailTemplate);
		}else{
			$('#MailTemplate').val('');
		}
	}
	//是否生成电子保单
	function IsEpolicyChange(){
		var $IsEpolicy =$.trim($('#isEpolicy').val());
		var $Download_right=$('#Download_right');
		if($IsEpolicy=='Y'){
			$Download_right.show();
			if(!epolicyType){
				 $.message("warn", "此产品未配置电子保单，请悉知。如需配置请联系管理员");
			}
		}else{
			$Download_right.hide();
		}
		var isEpolicyMali =$('#isEpolicyMali').val();
		if(isEpolicyMali=='1'){
		  	setEmailTemplate();
		}
	}
	//是否生成电子保函
	function IsEconfirmChange(){
		var $isEConfirm =$.trim($('#isEConfirm').val());
		if($isEConfirm=='Y'){
			if(!econfirmType){
				 $.message("warn", "此产品未配置电子保函，请悉知。如需配置请联系管理员");
			}
		}
	}
	//文件方式改变
	function fileTypeChange(){
		var isEpolicyMali =$('#isEpolicyMali').val();
		if(isEpolicyMali=='1'){
		  	setEmailTemplate();
		}
	}
	//是否电子发票
	function epolicyInvoiceChange(){
		var isEpolicyInvoice=$("#isEpolicyInvoice").val();
		if("1"==isEpolicyInvoice){
			$(".CinvockLink").show();
			$("#einvoiceInfo").show();
			isInsurEinvoiceChange();
		}else{
			$(".CinvockLink").hide();
			$("#einvoiceInfo").hide();
		}
		var isEpolicyMali =$('#isEpolicyMali').val();
		if(isEpolicyMali=='1'){
		  	setEmailTemplate();
		}
	}
	function isInsurEinvoiceChange(){
		var isInsuranceEinvoice=$("#isInsuranceEinvoice").val();
		/* var payEinvoice=$("#payEinvoice").val(); */
		if(isInsuranceEinvoice=='Y'){
			$("#payEinvoice").val('1');
			$('#payEinvoice').attr("disabled",true);
			$('#payEinvoice').css("background-color","#ccc");
		}else{
			$('#payEinvoice').attr("disabled",false);
			$('#payEinvoice').css("background-color","");
		}
	}
	//是否生成电子发票下载链接
	function invockLinkChange(flag1){
		var isEpolicyMali =$('#isEpolicyMali').val();
		if(isEpolicyMali=='1'){
		  	setEmailTemplate(flag1);
		}
	}
	function boxChange(){
		var isEpolicyMali =$('#isEpolicyMali').val();
		if(isEpolicyMali=='1'){
		  	setEmailTemplate();
		}
	}
<%-- 销售代理信息为只读状态--%>
function salesInfoReadOnly(){
	var channleCode_QD = $.trim($("#channelCodeQD").val());
	$('#serviceName').attr("readonly",true).css('background-color','#ccc');
	$('#agentNo').attr("readonly",true).css('background-color','#ccc');
	$('#protocolNo').attr("readonly",true).css('background-color','#ccc');
	$('#agentName').attr("readonly",true).css('background-color','#ccc');
	if(channleCode_QD == null || channleCode_QD == ''){
		$('#channelType').attr("disabled",true).css('background-color','#ccc');
		$('#newBsnsType').attr("disabled",true).css('background-color','#ccc');
	}
}
//------------------------------------------与销管联调结束-------------------------------------------
</script>
</head>
<body>
<%-- 是否网销专属方案--%>
<input type="hidden"  id="isInternetPlan" value=""/>
<c:if test="${not empty param.planCode }">
<input type="hidden" value="<%=request.getParameter("planCode").toString()%>" id="hidepno"/>
	      <div class="current">
           <table class="current_table_1">
              <tbody>
                <tr class="f2">
                  <td>
                    <img src="./images/current_1.jpg">
                  </td>
                  <td class="current_table_1_td">
                    <img src="images/current_1.png">&nbsp;您现在的位置：&nbsp;
                      <span style=" color:#136bab; ">财险产品管理
                         <span style="padding:0 5px; font-weight:bold; line-height:28px;">&gt;</span>方案配置
                         <span style="padding:0 5px; font-weight:bold; line-height:28px;">&gt;</span>投保方案编辑
                      </span>
                  </td>
                  <td><img src="./images/current_3.jpg"></td>
              </tr>
           </tbody>
         </table>
      </div>
</c:if>
<c:if test="${empty param.planCode }">
	      <div class="current">
           <table class="current_table_1">
              <tbody>
                <tr class="f2">
                  <td>
                    <img src="./images/current_1.jpg">
                  </td>
                  <td class="current_table_1_td">
                    <img src="images/current_1.png">&nbsp;您现在的位置：&nbsp;
                      <span style=" color:#136bab; ">财险产品管理
                         <span style="padding:0 5px; font-weight:bold; line-height:28px;">&gt;</span>方案配置
                         <span style="padding:0 5px; font-weight:bold; line-height:28px;">&gt;</span>投保方案新增
                      </span>
                  </td>
                  <td><img src="./images/current_3.jpg"></td>
              </tr>
           </tbody>
         </table>
      </div>
</c:if>
	     
			<form id="inputForm" >
		<!-- 	<input id="agentType" type="hidden">销售类型  -->
	        <table class="table_05">
	              <tbody>
		              <tr>
			              <c:if test="${not empty param.planCode }">
			                  <td colspan="4" style=" font-size:12px; font-weight:bold; text-align:left;color:#3876bf; line-height:17px; background-image:url(images/centent_1.jpg)">投保方案编辑</td>
			              </c:if>
			              <c:if test="${empty param.planCode }">
			                  <td colspan="4" style=" font-size:12px; font-weight:bold; text-align:left;color:#3876bf; line-height:17px; background-image:url(images/centent_1.jpg)">投保方案新增</td>
			              </c:if>
		              </tr>
		    		  <tr>
		                  <th width="10%">方案代码：</th>
		                  <td width="40%"><input name="planCode" id="planCode" type="text" readonly="readonly" style=" background-color: #ccc;" class="input_text"><span class="red">*</span>
		                  
		                  &nbsp;<span  style="${ptnEnv}">上线方案专用：<input type="checkbox" id='isProprod'/>&nbsp;<img src="/manager/images/caldef.jpg" title="此选项可保证测试环境与生产环境方案号一致及防止方案号冲突。仅供后续会升级正式环境的方案使用，不上线的方案不允许勾选！"></span>
		                  </td>
		                  <th width="10%">方案名称：</th>
		                  <td width="40%"><input id="planName" type="text"  maxlength="100" class="input_text" ><span class="red">*</span></td>
		              </tr>
		              <tr>
		                  <th width="10%">产品代码：</th>
		                  <td width="40%">
		                  	<input name="prodCode" id="prodCode" type="text" readonly="readonly" style=" background-color: #ccc;" class="input_text"><span class="red">*</span>&nbsp;
		                  	<c:if test="${empty planCode}">
		                  		<input type="button"  class="input_button_2" id="searchProdBtn" value="请选择" onClick="openProdDiv(1,this)"/>
		                  	</c:if>
		                  	<c:if test="${not empty planCode}">
		                  		<input type="button"  disabled="disabled" id="searchProdBtn" value="请选择" onClick="openProdDiv(1,this)"/>
		                  	</c:if>
		                  </td>
		                  <th width="10%">产品名称：</th>
		                  <td width="40%"><input name="prodName" id="prodName" type="text" readonly="readonly" style=" background-color: #ccc;" class="input_text"><span class="red">*</span></td>
		              </tr>
		              <tr>
		              	  <th>合作伙伴：</th>
		                  <td>
		                  	<input name="partnerCode" id="partnerCode" type="text" readonly="readonly" style=" background-color: #ccc;" class="input_text"><span class="red">*</span>&nbsp;
		                  	<c:if test="${empty planCode}">
		                  		<input type="button"  class="input_button_2" id="searchPartnerBtn" value="请选择" onClick="openThisDiv('tradPartnerDiv',1,this)"/>
		                  	</c:if>
		                  	<c:if test="${not empty planCode}">
		                  		<input type="button" disabled="disabled" id="searchPartnerBtn" value="请选择" onClick="openThisDiv('tradPartnerDiv',1,this)"/>
		                  	</c:if>
		                  </td>
		                  <th>方案状态：</th>
		                  <td><select id="status" class="select_1 valid" style="visibility: visible;"><option value="0">无效</option><option value="1">有效</option></select></td>
		              </tr>
		               <tr>
		              	  <th>方案销售类型：</th>
		                  <td>
		                  		<select id="agentType" name="agentTypeSel" onchange="agentChange()" class="select_1 valid" style="visibility: visible;">
	 								<c:forEach var ="agentType" items="${agentTypes}">
		                  				<option value="${agentType.code}" title="${agentType.codeName}">${agentType.codeName}</option>
		                  			</c:forEach>
		                  		</select>
						   		<input id="unionMessageConfig" type="button" style="display:none" onclick="openMessageConfig()" value="车加意-关联信息配置" title="注意：仅车加意方案需进行此配置，需在编辑页面操作"/>
		                  </td>
		                  <th>跟单费用配置：</th>
		                  <td>
		                  	<select id="agentFeeConfig" name="agentFeeConfig" onchange="agentFeeConfigChange()" class="select_1 valid" style="visibility: visible;background-color: #ccc;"  disabled="disabled">
			                  	 <option value="" >请选择</option>
	                  			 <option value="1" >接口传入</option>
			                  	 <option value="2" >合作伙伴配置</option>
	                  		</select>
		                  </td>
	              </tr>
		              <tr>
		                  <th id='cRate'>手续费比例：</th>
		                  <td>
		                  	<input name="commRate" id="commRate" type="text"  maxlength="10" class="input_text" onKeyUp="clearNoNum(event,this)" onBlur="checkNum(this)">
		                  	<span class="red" style="margin-left: -5px">*</span>&nbsp;<span id="commRateSpan" class="blue"></span>
		                  	<!-- 手续费比例上下限，验证使用 -->
		                  	<input id="feeMaxRate" type="hidden" value="1"/>
		                  	<input id="feeMinRate" type="hidden" value="0"/>
		                  </td>
		                  <th id='mRate'>市场维护费比例：</th>
		                  <td>
		                  	<input name="marketPreserveRate" id="marketPreserveRate" type="text"  maxlength="10" class="input_text" onKeyUp="clearNoNum(event,this)" onBlur="checkNum(this)" value="0">
		                  	<span class="red" style="margin-left: -5px">*</span>&nbsp;
		                  </td>
		              </tr>
		                <tr>
		                  <th id='bRate'>业务绩效比例：</th>
		                  <td>
		                    <input name="businessPerformanceRate" id="businessPerformanceRate" type="text"  maxlength="10" class="input_text" onKeyUp="clearNoNum(event,this)" onBlur="checkNum(this)" value="0">
		                  	<span class="red" style="margin-left: -5px">*</span>&nbsp;
		                  </td>
		                  <th id="deptCode101">出单机构：</th>
		                  <td id="deptCode102">
		                  	<input id="deptCode"  type="text" readonly="readonly" style=" background-color: #ccc;" class="input_text"><span class="red" name="wxflag">*</span>&nbsp;
		                  	<input type="button"  class="input_button_2" id="searchDeptBtn" value="请选择" onClick="openDeptDiv(1,this)"/>
		                  </td>
		              </tr>
<!-- --------------------------根据产品销售方式的不同改变以下内容-------------------------------------- -->		              
		              <!--agentType1  合作伙伴代理   -->
		              <tr id="agentType101">
		                  <th>业务员代码：</th>
		                  <td>
<!-- 		                  <input name="empNo" id="empNo" type="text"  maxlength="20" class="input_text"><span class="red">*</span> -->
		                  	<div id="empNo_select_div" style="display: none">
			              		<select id="empNo_select" onchange="changeEmpNo()" class="select_1"></select>
			              	</div>
			              	<input id="empNo" class="input_text" name="empNo" maxlength="10" readonly="readonly" style="background-color: #CCC"/>
			              	<span class="red" style="margin-left: -5px" name="wxflag">*</span>
<%--		                  	&nbsp;<input type="button"  class="input_button_2"   value="手动录入" onClick="inputBtn()"/>		--%>
		                  </td>
		              	  <th>业务员名称：</th>
		              	  <td><input id="empName" class="input_text"   readonly="readonly" style="background-color: #CCC" ></td>
		              </tr>
		              <tr id="agentType102">
		              	  <th>团队代码：</th>
						  <td>
							  <div id="teamCode_select_div" style="display: none" >
								 <select id="teamCode_select" onchange="changeTeamCode()" class="select_1"></select>
							  </div>
						 	  <input id="teamCode" onclick="changeEmpNo()"  name="teamCode"  readonly="readonly" style="background-color: #CCC"  class="input_text" maxlength="11"/>
						 	  <span class="red" style="margin-left: -5px" name="wxflag">*</span>&nbsp;
						  </td>
		                  <th>团队名称：</th>
		                  <td><input id="teamName" name="teamName"  readonly="readonly" style="background-color: #CCC" class="input_text"><span class="red" name="wxflag">*</span></td>
		              </tr>
					  <tr id="qudaoandlaiyuan01">
						  <th>归属渠道：</th>
						  <td>
							  <select id="channelCodeQD" class="select_1 valid" style="visibility: visible;background-color: #ccc "  disabled="disabled">
								  <option value="">-----请选择-----</option>
								  <c:forEach var ="btcList" items="${btcList}">
									  <option value="${btcList.code}">${btcList.codeName}</option>
								  </c:forEach>
							  </select><span class="red" name="wxflag">*</span></td>
						  <th>渠道类型：</th>
						  <td>
							  <select id="channelType" class="select_1 valid" style="visibility: visible;" >
								  <option value="">-----请选择-----</option>
								  <c:forEach var ="channelList" items="${channelList}">
									  <option value="${channelList.code}">${channelList.codeName}</option>
								  </c:forEach>
							  </select><span class="red" name="wxflag">*</span></td>
					  </tr>
					  <tr id="qudaoandlaiyuan02">
						  <th>新业务来源：</th>
						  <td>
							  <select id="newBsnsType"   class="select_1 valid" style="visibility: visible;">
								  <option value="">-----请选择-----</option>
								  <c:forEach var ="newBSList" items="${newBSList}">
									  <option value="${newBSList.code}">${newBSList.codeName}</option>
								  </c:forEach>
							  </select><span class="red" name="wxflag">*</span></td>
						  <th>旧业务来源：</th>
						  <td>
							  <select id="bsnsType" class="select_1 valid" style="visibility: visible;background-color:#ccc" disabled="disabled">
								  <option value="">-----请选择-----</option>
								  <c:forEach var ="oldBSList" items="${oldBSList}">
									  <option value="${oldBSList.code}">${oldBSList.codeName}</option>
								  </c:forEach>
							  </select><span class="red" name="wxflag">*</span></td>
					  </tr>
		              <tr id="agentType103">
		              <th>代理人代码：</th>
		                   <td>
		                  	<div id="agentNo_select_div" style="display: none">
		                  		<select id="agentNo_select" onchange="changeAgentNo()" class="select_1"></select>
		                  	</div>
		                  	<input id="agentNo" name="agentNo" class="input_text"  readonly="readonly" style="background-color: #CCC"/>
		                  	<span id="agentNoButtonHidden">
		                  		<span class='red' style='margin-left: -5px' name="wxflag">*</span>
		                  	</span>
		                  </td>
		                  <th>代理协议号：</th>
		                  <td><input id="protocolNo" name="protocolNo" readonly="readonly" style="background-color: #CCC" class="input_text" maxlength="13"/><span class='red' name="wxflag">*</span></td>
		              </tr>
		              <tr id="agentType104">
			              <th>服务代码：</th>
		                  <td>
		                  	<div id="serviceCode_select_div" style="display: none">
		                  		<select id="serviceCode_select" onchange="changeServiceCode()" class="select_1"></select>
		                  	</div>
		                  	<input id="serviceCode"  readonly="readonly" style="background-color: #CCC"  name="serviceCode" class="input_text"/>
		                  	<span class="red" style="margin-left: -5px" name="wxflag">*</span>&nbsp;
		                  </td>
		                  <th>服务名称：</th>
		                  <td><input id="serviceName" name="serviceName" readonly="readonly" style="background-color: #CCC"   class="input_text" name="wxflag"/></td>
		              </tr>
		              <!--广东分公司个人销售业务信息 -->
		              <tr id="sale1" style="display:none">
		                  <th>跟单人员配置信息：</th>
		                  <td colspan="3"><input type="button" onclick="opensaleDiv()" value="广东销售信息配置"/></td>
		              </tr>
		              <tr id="sale2" style="display:none">
		                  <td colspan="4">
		                  	<div style="width:1100px; height:200px; overflow:scroll;">
			                  	<table id="agentType30Table"  style="width:99%;">
			                  		<thead>
										<tr style="background-color: C0C0C0;">
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">序号</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">销售员类型<span style="margin-left: -5px" class="red">*</span></th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">费用比例<span style="margin-left: -5px" class="red">*</span></th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">执业证号</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">人员类别<span style="margin-left: -5px" class="red">*</span></th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">业务员<span style="margin-left: -5px" class="red">*</span></th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">销售员</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">代理人编号</th>
						              	</tr>
									</thead>
									<tbody id='saleShowDiv'>
						            </tbody>
			                  	</table>
		                  	</div>
		                  </td>
		              </tr>	
		              <!-- 广东分公司个人销售业务信息结束 -->
		              <!--agentType3   个人销售业务   -->
		              <tr id="agentType301" style="display:none">
		              	  <c:if test="${not empty planCode}">
		                  <th>个人销售业务信息：</th>
		                  <td colspan="3"><input type="button" onclick="openNocarAgentType3Div(1,this)" value="配置个人销售渠道信息"/></td>
		                  </c:if>
		                  <c:if test="${empty planCode}">
		                  <th>个人销售业务信息：</th>
		                  <td colspan="3"><input type="button" disabled="disabled" onclick="openNocarAgentType3Div(1,this)" value="配置个人销售渠道信息"/></td>
		              	  </c:if>
		              </tr>
		              <c:if test="${not empty planCode}">
					  <tr id="agentType302" style="display:none">
		                  <td colspan="4">
		                  	<div style="width:1100px; height:auto; overflow:scroll;">
			                  	<table id="agentType3Table"  style="width:1400px;">
			                  		<thead>
										<tr style="background-color: C0C0C0;">
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">用户名</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">姓名</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">出单机构</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">服务代码</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">业务员代码</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">单证领用人</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">团队代码</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">归属渠道</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">渠道类型</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">新业务来源</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">原业务来源</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">代理人编码</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">代理协议号</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">手续费比例</th>
						              	 <th style="border: #292421 solid 1px;width:130px;text-align: center;">市场维护费比例</th>
						              	 <th style="border: #292421 solid 1px;width:100px;text-align: center;">业务绩效比例</th>
						              	</tr>
									</thead>
									<tfoot>
										<tr>
						                  <td colspan="16">
						                  	<div id="agentType3TablePageDIV" class="page"></div>
						                  </td>
						              	</tr>
									</tfoot>
									<tbody>
						            </tbody>
			                  	</table>
		                  	</div>
		                  </td>
		              </tr>	
					  </c:if>
		              <!--agentType4   总对总销售业务   -->
		              <tr id="agentType401" style="display:none">
		                  <c:if test="${not empty planCode}">
		                  <th>总对总销售业务信息:</th>
		                  <td colspan="3"><input type="button" onclick="openNocarAgentType4Div(1,this)" value="配置总对总销售渠道信息"/></td>
		                  </c:if>
		             	  <c:if test="${empty planCode}">
		             	  <th>总对总销售业务信息:</th>
		                  <td colspan="3"><input type="button" disabled="disabled" onclick="openNocarAgentType4Div(1,this)" value="配置总对总销售渠道信息"/></td>
		             	  </c:if>
		              </tr>
		              <c:if test="${not empty planCode}">
					  <tr id="agentType402" style="display:none">
		                  <td colspan="4">
		                  	<div style="width:1100px; height:auto; overflow:scroll;">
			                  	<table id="agentType4Table"  style="width:2000px;">
			                  		<thead>
										<tr style="background-color: C0C0C0;">
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">网点代码</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">网点名称</th>
						             	  <th style="border: #292421 solid 1px;width:100px;text-align: center;">用户名</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">姓名</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">区域代码</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">出单机构</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">服务代码</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">业务员代码</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">单证领用人</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">团队代码</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">归属渠道</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">渠道类型</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">新业务来源</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">原业务来源</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">代理人编码</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">代理协议号</th>
						                  <th style="border: #292421 solid 1px;width:100px;text-align: center;">手续费比例</th>
						              	  <th style="border: #292421 solid 1px;width:100px;text-align: center;">市场维护费比例</th>
						              	  <th style="border: #292421 solid 1px;width:100px;text-align: center;">业务绩效比例</th>
						              	</tr>
									</thead>
									<tfoot>
										<tr>
						                  <td colspan="19">
						                  	<div id="agentType4TablePageDIV" class="page"></div>
						                  </td>
						              	</tr>
									</tfoot>
									<tbody>
						            </tbody>
			                  	</table>
		                  	</div>
		                  </td>
		              </tr>	
					  </c:if>
					<!-- 方案接口传入 -->
					    <!--agentType6  销售类型6 跟单费用配置接口传入  -->
	              <tr id="agentType601" style="display:none">
	              	<c:if test="${not empty planCode }">
	                  <th>第三方传入方案跟单费用配置：</th>
	                  <td colspan="3"><input type="button" onclick="openAgentInfo6Div(1)" value="跟单费用配置选择"/></td>
	              	</c:if>
	              	<c:if test="${empty planCode }">
	                  <th>第三方传入方案跟单费用配置：</th>
	                  <td colspan="3"><input type="button" disabled="disabled" onclick="openAgentInfo6Div(1)" value="跟单费用配置选择"/></td>
	              	</c:if>
	              </tr>
	              <c:if test="${not empty planCode}">
	               <tr id="agentType602">
	                  <td colspan="4">
                       <div style="height:auto; overflow:scroll;">
                       <span><span id='agentNameTitle'></span> </span>
	                  	<table id="agentInfoRela6Table" style="width: 100%" >
	                  		<thead>
							 <tr style="background-color: C0C0C0;" id="agentFeeTitle">
							 	<th style="text-align: center;">机构</th>
				                 <th style="text-align: center;">手续费比例（%）</th>
				                 <th style="text-align: center;">市场维护费比例（%）</th>
				                 <th style="text-align: center;">业务绩效比例（%）</th>
				             </tr>
							</thead>
							<tfoot>
								<tr>
				                  <td colspan="22">
				                  	<div id="agentInfoRela6PageDIV" class="page"></div>
				                  </td>
				              	</tr>
							</tfoot>
							<tbody>
				            </tbody>
	                  	</table>
	                   </div>
	                  </td>
	              </tr>
	              </c:if>
					<!-- 方案接口传入结束 -->					  
<!-- --------------------------根据产品销售方式的不同改变以上内容-------------------------------------- -->		              
		              <tr>
		                  <th>是否见费出单：</th>
		                  <td><select id="isSeeMoney" onchange="SeeMoneyChange()" class="select_1 valid" style="visibility: visible;"><option value="N">否</option><option value="Y">是</option></select></td>
		                  <th>是否电子保单：</th>
		                  <td>
		                  	<div id="Download_left" style="float: left; width: 15%"><select id="isEpolicy" class="select_1 valid" onchange="IsEpolicyChange()" style="visibility: visible; width: 60px"><option value="N">否</option><option value="Y">是</option></select></div>
	                  		<div id="Download_right" style="float: left;display: none;">
								下载方式：<select id="DownloadWay" class="select_1 valid" style="visibility: visible;width: 100px" onchange='downloadWayChange()'><option value="0">实时电子保单</option><option value="1">影像系统获取</option></select>		                  		
	                  			<span style="display: none;" id='fileTypeSpan'>文件方式：
		                  			<select id="fileType" class="select_1 valid" style="visibility: visible;width: 80px;" onchange="fileTypeChange()">
		                  				<c:forEach var ="fileType" items="${fileTypes}">
			                  				<option value="${fileType.code}">${fileType.codeName}</option>
			                  			</c:forEach>
		                  			</select>
	                  			</span>		                  		
	                  		</div>
		                  </td>
		              </tr>
		              <tr>
		                  <th>是否打印单证：</th>
		                  <td>
		                  	<select id="isPrintCard" onchange="checkPrintCard()" class="select_1" style="visibility: visible;">
		                  		<option value="">----请选择----</option>
		                  		<option value="Y">是</option>
		                  		<option value="N">否</option>
		                  	</select><span class="red">*</span>
		                  </td>
		                  <th>单证类型：</th>
		                  <td>
		                  	<div style="float: left;">
		                  		<input id="cardType" type="text" readonly="true" style=" background-color: #ccc;" class="input_text"><span class="red">*</span>
		                  	</div>
		                  	<div id="cardApplicant_div" style="float: left;">
		                  		单证领用人：<input id="cardApplicant" type="text" readonly="true" style=" background-color: #ccc; width:100px" class="input_text"><span class="red">*</span>
		                  	</div>
		                  </td>
		              </tr>
		              <tr>
					  		<th>是否发送电子发票：</th>
					  		<td>
					  			<select id="isEpolicyInvoice" class="select_1 valid" style="visibility: visible;" onchange="epolicyInvoiceChange()"><option value="2">否</option><option value="1">是</option></select>
					  			&nbsp;<span class='CinvockLink' style="display: none">电子发票下载链接&nbsp;</span><select id="invockLink" class="select_1 valid CinvockLink" style="visibility: visible;width: 70px;display: none" onchange="invockLinkChange()"> <option value="S">请选择</option><option value="N">不生成</option><option value="Y">生成</option></select>
					    		<img class='CinvockLink'  style="display: none" src="/manager/images/caldef.jpg" title="如果需要接口、邮件、或短信内容包括电子发票下载链接，则需选择“生成”选项">
					  		</td>	
					  		<th>是否开通支付平台：</th>
					  		<td><select id="isDredgePay" class="select_1 valid" disabled="disabled" style="visibility: visible; background-color: #ccc"><option value="1">是</option><option value="2">否</option></select></td>			
					  </tr>
					  <tr id="einvoiceInfo" style="display: none">
						<th>发票购方：</th>
				  		<td>
							<select id="payEinvoice" class="select_1 valid" style="visibility: visible;width: 100px;">
                  				<c:forEach var ="payEinvoice" items="${payEinvoices}">
	                  				<option value="${payEinvoice.code}">${payEinvoice.codeName}</option>
	                  			</c:forEach>
		                  	</select>
			  			</td>	
				  		<th >承保时支持开票：</th>
				  		<td >
				  			<select id="isInsuranceEinvoice" class="select_1 valid" style="visibility: visible;" onchange="isInsurEinvoiceChange()"><option value="Y">是</option><option value="N">否</option></select>
				  		</td>						  		
			  		</tr>
					  <tr>
		              	 <th>是否发送承保短信：</th>
		                  <td>
		                  	<div style="float: left;width:18%;">
		                  		<select name="is_message" onchange="checkIsMessage()" id="is_message" class="select_1 valid" style="visibility: visible;width:95%;"><option value="N">否</option><option value="Y">是</option></select>
		                  	</div>
		                  	<div id="messageReceiverDiv"  style="float: left;display:none;width:35%;">
		                  		接收人：<select name="messageReceiver"    id="messageReceiver" class="select_1 valid" style="visibility: visible;width:65%;"><option value="">请选择</option><option value="0">投保人</option><option value="1">被保人</option></select>
		                  	</div>
		                  	<div id="smsTemplateDiv"  style="float: left;display:none;width:47%;">
		                  		短信模板：
		                  		<select name="smsTemplate" id="smsTemplate" onchange="changeIsMessageTemplate()"  class="select_1 valid" style="visibility: visible;width:60%;">
		                  			<option value="">----请选择----</option>
		                  			<c:forEach var ="messageList" items="${messageList}">
		                  				<option value="${messageList.smsTemplateCode}">${messageList.smsTemplateName}</option>
		                  			</c:forEach>
		                  		</select>
		                  	</div>
		                  </td>
		                  <th>是否发送注销短信：</th>
		                  <td>
		                 	  <div style="float: left;width:18%;">
		                  		<select name="isCancelMessage" id="isCancelMessage" onchange="changeIsCancelMessage()" class="select_1 valid" style="visibility: visible;width:95%;">
			                  		<option value="N">否</option>
			                  		<option value="Y">是</option>
		                  		</select>
		                  	  </div>
		                  	  <div id="cancelReceiverDiv"  style="float: left;display:none;width:35%;">
		                  		接收人：<select name="cancelReceiver"  id="cancelReceiver" class="select_1 valid" style="visibility: visible;width: 65%;"><option value="">----请选择---</option><option value="0">投保人</option><option value="1">被保人</option></select>
		                  	  </div>
		                  	  <div id="cancelTemplateDiv"  style="float: left;display:none;width:47%;">
		                  		短信模板：
		                  		<select name="isCancelTemplate"  id="isCancelTemplate" onchange="changeIsCacelTemplate()" class="select_1 valid" style="visibility: visible;width:60%;">
		                  			<option value="">----请选择----</option>
		                  			<c:forEach var ="cacelList" items="${cacelList}">
		                  				<option value="${cacelList.smsTemplateCode}">${cacelList.smsTemplateName}</option>
		                  			</c:forEach>
		                  		</select>
			                  </div>
		                  </td>
		              </tr>
					  <tr>
					  		<th>是否发送电子邮件：</th>
					  		<td><select id="isEpolicyMali" onchange="CheckedSendMail()" class="select_1 valid" style="visibility: visible;"><option value="2">否</option><option value="1">是</option></select>
					  		  <span id="sendAccessory" style="display: none">
			                		  附件发送：
			                  </span>
					  		<span id="sendAccessoryTd" style="display: none">
						  		<c:if test="${not empty Accessorylist}">
						  				<c:forEach items="${Accessorylist}" var="acc">
						  				<c:if test="${acc.code =='01'}">
						  				<input type="checkbox" name="SendAccessoryBox" id="SendAccessoryBox"  value="${acc.code}" onchange="boxChange()"> <span style="margin-left: 5px">${acc.codeName}</span>
						  				</c:if>
						  				</c:forEach>
						  			</c:if>
						  			<c:if test="${not empty AccessoryEditlist}">
						  				<c:forEach items="${AccessoryEditlist}" var="acc">
						  				<c:if test="${acc.code =='01'}">
						  					<input type="checkbox" name="SendAccessoryBox" id="SendAccessoryBox"  value="${acc.code}" onchange="boxChange()"> <span style="margin-left: 5px">${acc.codeName}</span>
						  				</c:if>
						  				</c:forEach>
						  			</c:if>
					  		</span>
					  		</td>	
					  		
					  		<th >特别约定配置方式：</th>
					  		<td>
					  			<select id="specialConfigType" onchange="specialConfigTypeChange()" class="select_1 valid" style="visibility: visible;">
					  		      <option value="2">合作伙伴配置</option>
					  		      <option value="1">接口传入</option>
					  		    </select>
					  		</td>			
					  </tr>
						<tr>
							<th>分公司纳税人识别号：</th>
						  	<td><input id="dentification" class="input_text"/></td>	
						   <th>是否支持回执：</th>
		                 <td>
		                  <div style="float:left;">
		                  		<select name="isReceipt" id="isReceipt" onchange="chooseReceiptType()" class="select_1 valid" style="visibility: visible;"><option value="N">否</option><option value="Y">是</option></select>
		                  </div>
		                  <div id="isOrNotDisplayReceiptTypeDiv"  style="float:left;display:none;">
			              	回执类型：<select id = "receiptType" class="select_1 valid" style="visibility: visible;vertical-align: middle; width: 110px;">
			                    <c:forEach var ="receiptTypeLsCode" items="${receiptTypeLs}">
				                	<option value="${receiptTypeLsCode.code}">${receiptTypeLsCode.codeName}</option>
				                </c:forEach>
			                  </select>
			              </div>
		                  </td>
				  		</tr>
				  		<tr>
						 <th>是否电子批单：</th>
		                 <td>
		                  <div style="float:left;">
		                  		<select name="isedrno " id="isedrno" onchange="chooseIsedrno()" class="select_1 valid" style="visibility: visible;"><option value="N">否</option><option value="Y">是</option></select>
		                  </div>
		                  <div id="isOrNotDisplayEdrnoTypeDiv"  style="float:left;display:none;">
			              	电子批单类型：<select id = "edrnoType " class="select_1 valid" style="visibility: visible;vertical-align: middle; width: 110px;">
			                    <c:forEach var ="receiptTypeLsCode" items="${edrnoTypes}">
				                	<option value="${receiptTypeLsCode.code}">${receiptTypeLsCode.codeName}</option>
				                </c:forEach>
			                  </select>
			              </div>
		                  </td>
		                   <th>是否电子保函：</th>
		                 <td>
		                  <div style="float:left;">
		                  		<select name="isEConfirm" id="isEConfirm"  class="select_1 valid" style="visibility: visible;" onchange="IsEconfirmChange()"><option value="N">否</option><option value="Y">是</option></select>
		                  </div>
		                  </td>
				  		</tr>
					    <tr>
							<th id="isPushedSalesInfo1" width="10%" style="display: none">是否已推送销售信息:  </th>
							<td id="isPushedSalesInfo2"  class="input_text" style="display: none">
								<div style="float: left;width: 190px;">
									<select id="isPushedSalesInfo" class="select_1 " style="background-color: #ccc;" disabled="disabled">
										<option value="N">否</option>
										<option value="Y">是</option>
									</select>
								</div>
							</td>
						</tr>
		              <tr id="MailTemplateTr" style="display: none;">
	              	  		<th>邮件模板配置：</th>
	              	  		<td colspan="3"><textarea name="MailTemplate" id="MailTemplate" rows="5" cols="" class="textarea_1" style="resize:none"></textarea><span class="red">*</span> </td>
	              	  </tr>
		              <tr  id="messageTemplateTr" style="display:none">
		                  <th >承保短信模板配置：</th>
		                  <td colspan="3"><textarea name="messageTemplate" id="messageTemplate" cols="" rows="5" class="textarea_1" style="resize:none;">【燕赵保险】尊敬的客户您好，您已成功投保我司xxx险种，保单号为xxxxx。保险期间20150412--20150413。保单详细信息查询网站：http://query.cic.cn，报案电话95585。</textarea><span class="red">*</span></td>
	              	  </tr>
	              	    <tr id="cancelTemplateTr" style="display:none">
	                  <th>注销短信模板配置：</th>
	                  		<td colspan="3"><textarea name="cancelTemplate" id="cancelTemplate" rows="5" class="textarea_1" style="resize:none;"></textarea><span class="red">*</span></td>
	              		</tr>
		              <tr>
		                  <th>特别约定：</th>
		                  <td colspan="3"><textarea name="specialArran" id="specialArran" cols="" rows="5" class="textarea_1" style="resize:none;"></textarea></td>
	              	  </tr>
	           	  </tbody>
	         </table> 
	         <div align="center">
	             <input class="input_button_3" name="" id="sbtn" type="button" onclick="checkAndExcute('add')" value="保存">&nbsp;&nbsp;
		         <input class="input_button_3" name="" type="button" value="返回" onclick="goBack()">
	         </div>
	         </form>
		      </div>    
	</div>
		<!--   	产品 DIV 默认隐藏-->
  		  		<div id="prodDiv"  style="display:none;width:80%;">
			<input type="hidden" id="row_num" name="row_num" value="0"/>
				<div class="table_title_div">
					<table class="table_title" style='width:100%;height:20px;'>
						<tr>
						<td width="10%"></td>
						<td width="80%" id="interfaceName"></td>
						<td width="10%" align="right"><img src="./images/closedown.gif" alt="关闭"  onclick="closeCurrentDIV('prodDiv')"/></td>
						</tr>
					</table>
				</div>
	
			<!-- 修改id 名 -->
			<table class="table_02" id="addtempletTable" align="center" >
				<tbody>
				<tr>
				<td>
					<table class="search_table">
					<tr height="30px" >
							<td style="border:0px;text-align: right;">交易系统产品代码：</td>
							<td style="border:0px;text-align: left;">
								<input name="txt3"  id="prodcode"  type="text" class="input_text" value="" style="width:120px;">
							</td>
							<td style="border:0px;text-align: right;">
								交易系统产品描述：
							</td>
							<td style="border:0px;text-align: left;"><input name="txt3" id="proddesc"  type="text" class="input_text" value="" style="width:120px;"></td>
					</tr>
					<tr height="30px" >
							<td style="border:0px;text-align: right;">定义起期：</td>
							<td style="border:0px;text-align: left;">
								<input id="startDate" onkeydown="false" onclick="showCalendar('startDate','y-mm-dd');$('.calendars').css('z-index',20000);" class="input_time" type="text" style="width:120px;"/>
							</td>
							<td style="border:0px;text-align: right;">
							定义止期：
							</td>
							<td style="border:0px;text-align: left;">
								 <input id="endDate" onkeydown="false" onclick="showCalendar('endDate','y-mm-dd');$('.calendars').css('z-index',20000);" class="input_time" type="text" style="width:120px;"/>
								 &nbsp;&nbsp;&nbsp;&nbsp;
								<input type="button"  class="input_button_1" id="searchBtn" value="查询" onClick="queryTradProdInst(1)"/>
							</td>
					</tr>
				</table>
				</td></tr>
					<tr>
						<td>
							<!-- 修改数据table名 -->
							<table id="productTable"  class="content_table_1">
								<thead>
									<tr class="f1">
					                  <th style="width:5%">选择</th>
					                  <th style="width:45%">交易系统产品代码</th>
					                  <th style="width:50%">交易系统产品描述</th>
					              	</tr>
								</thead>
								<!-- 修改tobody 默认为空 -->
								<tbody>
								</tbody>
							</table>
							<!-- 修改分页编码id 名  默认为空-->
							<div id="productPageDIV" class="page">
							</div>
						</td>
					</tr>
				</tbody>
			</table>
			<div align="center" >
			 <input class="input_button_3" name="" type="button" onclick="chooseProd()" value="确定">&nbsp;&nbsp;
	         <input class="input_button_3" name="" type="button" onclick="closeCurrentDIV('prodDiv')" value="取消">
			</div>
	   </div>
	
	
	<!--   	选择 合作伙伴 div-->
  		<div id="tradPartnerDiv" style="display:none;width:80%;">
  		<input type="hidden" id="row_num" name="row_num" value="0"/>
			<div class="table_title_div">
					<table class="table_title" style='width:100%;height: 20px;'>
						<tr>
						<td width="10%"></td>
						<td width="80%" id="interfaceName"></td>
						<td width="10%" align="right"><img src="./images/closedown.gif" alt="关闭"  onclick="closeCurrentDIV('tradPartnerDiv')"/></td>
						</tr>
					</table>
			</div>
		<table class="table_02" id="table" style="height:180px;" align="center">
			<tr>
				<td>
					<table class="search_table">
						<tr height="30px">
							<td colspan="3" style="text-align:center">
							 合作伙伴代码：<input name="txt3"  id="channelCode"  type="text" class="input_text" value="" >&nbsp;&nbsp;
							 合作伙伴名称：<input name="txt3" id="channelName"  type="text" class="input_text" value="">&nbsp;&nbsp;
								       <input type="button"  class="input_button_1" id="searchBtn" value="查询" onClick="queryTradPartners(1)"/>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<table id="TradPartnerTable"  class="content_table_1">
						<thead>
							<tr class="f1">
			                  <th style="width:5%">选择</th>
			                  <th style="width:10%">合作伙伴代码</th>
			                  <th style="width:20%">合作伙伴名称</th>
			              	</tr>
						</thead>
						<tbody>
						</tbody>
					</table>
					<div id="TradPartnerPageDIV"  class="page"></div>
				</td>
			</tr>
		</table>
		<div align="center" >
		  <input type="button" id="saveRoleBtn" value="确定" onclick="choosePartner()" class="input_button_3"/>&nbsp;&nbsp;&nbsp;
		  <input type="button" value="取消" onclick="closeCurrentDIV('tradPartnerDiv')" class="input_button_3"/>
		</div>
	</div>	
	
	
	<!--   	机构 DIV 默认隐藏-->
	<div id="deptDiv" style="display:none;width:80%;">
  		<input type="hidden" id="row_num" name="row_num" value="0"/>
			<div class="table_title_div">
					<table class="table_title" style='width:100%;height: 20px;'>
						<tr>
						<td width="10%"></td>
						<td width="80%" id="interfaceName"></td>
						<td width="10%" align="right"><img src="./images/closedown.gif" alt="关闭"  onclick="closeCurrentDIV('deptDiv')"/></td>
						</tr>
					</table>
			</div>
		<table class="table_02" id="table" style="height:180px;" align="center">
			<tr>
				<td>
					<table class="search_table">
						<tr height="30px">
							<td colspan="3" style="text-align:center">
							 出单机构代码：<input name="txt3"  id="deptcode"  type="text" class="input_text" value="" >&nbsp;&nbsp;
							 出单机构名称：<input name="txt3" id="deptcnname"  type="text" class="input_text" value="">
								       <input type="button"  class="input_button_1" id="searchBtn" value="查询" onClick="queryCoreDept(1)"/>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<table id="deptTable"  class="content_table_1">
						<thead>
							<tr class="f1">
			                  <th style="width:5%">选择</th>
			                  <th style="width:45%">出单机构代码</th>
			                  <th style="width:50%">出单机构名称</th>
			              	</tr>
						</thead>
						<tbody>
						</tbody>
					</table>
					<div id="deptPageDIV"  class="page"></div>
				</td>
			</tr>
		</table>
		<div align="center" >
		  <input type="button" id="saveRoleBtn" value="确定" onclick="chooseDept()" class="input_button_3"/>&nbsp;&nbsp;&nbsp;
		  <input type="button" value="取消" onclick="closeCurrentDIV('deptDiv')" class="input_button_3"/>
		</div>
	</div>
	
	<!--配置个人销售业务信息 div-->
  	<div id="agentTypeDiv3" style="display:none;width:1000px; height:450px; overflow:scroll;">
		<div class="table_title_div" style="width: 1750px">
			<table class="table_title" style='width:1750px;height: 20px;'>
				<tr>
				<td width="120px"></td>
				<td width="1460px" id="interfaceName"></td>
				<td width="20px" align="right"><img src="./images/closedown.gif" alt="关闭"  onclick="closeNocarAgentTypeDiv('agentTypeDiv3')"/></td>
				</tr>
			</table>
		</div>
		<table class="table_02" id="table" style="width:1750px;" align="center">
			<tr>
				<td>
					<table class="search_table">
						<tr height="30px">
							<td colspan="10" style="text-align:center">
							<!-- 表单号不为空即编辑时显示配置状态 -->
							<c:if test="${not empty planCode}">
								配置状态：<select id="confStatus"><option value="ALL">全部</option><option value="YES">已配置</option><option value="NO">未配置</option></select>&nbsp;&nbsp;
							</c:if>
							<c:if test="${empty planCode}">
								<input id="confStatus" type="hidden"  value="ALL">
							</c:if> 
							 用户名：<input id="agentCode" type="text" class="input_text" value="">&nbsp;&nbsp;
							 姓名：<input id="agentName" type="text" class="input_text" value="">&nbsp;&nbsp;
								<input type="button"  class="input_button_1" id="searchBtn" value="查询" onClick="queryNocarConfProxyInfo3(1)"/>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<table id="agentTypeDiv3Table"  class="content_table_1">
						<thead>
							<tr class="f1">
			                  <th style="width:40px"><input id="agentTypeDiv3CheckAll" type="checkbox"></th>
			                  <th style="width:100px">用户名</th>
			                  <th style="width:100px">姓名</th>
			                  <th style="width:100px">出单机构</th>
			                  <th style="width:100px">服务代码</th>
			                  <th style="width:100px">业务员代码</th>
			                  <th style="width:100px">单证领用人</th>
			                  <th style="width:100px">团队代码 </th>
			                  <th style="width:120px">归属渠道</th>
					          <th style="width:120px">渠道类型</th>
					          <th style="width:130px">新业务来源</th>
					          <th style="width:130px">原业务来源</th>
			                  <th style="width:100px">代理人编码 </th>
			                  <th style="width:100px">代理协议号</th>
			                  <th style="width:100px">手续费比例 </th>
			                  <th style="width:130px">市场维护费比例</th>
			                  <th style="width:100px">业务绩效比例</th>
			              	</tr>
						</thead>
						<tbody>
						</tbody>
					</table>
					<div id="agentTypeDiv3Page"  class="page"></div>
				</td>
			</tr>
		</table>
		<div align="center" >
		  <input type="button" id="saveRoleBtn" value="保存" onclick="saveChooseNocarAgentType3()" class="input_button_3"/>&nbsp;&nbsp;&nbsp;
		  <input type="button" value="取消" onclick="closeNocarAgentTypeDiv('agentTypeDiv3')" class="input_button_3"/>
		</div>
	</div>
	
	<!--配置总对总销售业务信息 div-->
  	<div id="agentTypeDiv4" style="display:none;width:1000px; height:450px; overflow:scroll;">
		<div class="table_title_div" style="width: 1650px">
			<table class="table_title" style='width:1650px;height: 20px;'>
				<tr>
				<td width="120px"></td>
				<td width="1460px" id="interfaceName"></td>
				<td width="60px" align="right"><img src="./images/closedown.gif" alt="关闭"  onclick="closeNocarAgentTypeDiv('agentTypeDiv4')" /></td>
				</tr>
			</table>
		</div>
		<table class="table_02" id="table" style="width:1650px;" align="center">
			<tr>
				<td>
					<table class="search_table">
						<tr height="30px">
							<td colspan="10" style="text-align:center">
							<!-- 表单号不为空即编辑时显示配置状态 -->
							<c:if test="${not empty planCode}">
								配置状态：<select id="confStatus4"><option value="ALL">全部</option><option value="YES">已配置</option><option value="NO">未配置</option></select>&nbsp;&nbsp;
							</c:if>
							<c:if test="${empty planCode}">
								<input id="confStatus4" type="hidden"  value="ALL">
							</c:if>
							 网点代码：<input id="branch" type="text" class="input_text" value="">&nbsp;&nbsp;
							 网点名称：<input id="branchName" type="text" class="input_text" value="">&nbsp;&nbsp;
								<input type="button"  class="input_button_1" id="searchBtn" value="查询" onClick="queryNocarConfProxyInfo4(1)"/>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<table id="agentTypeDiv4Table"  class="content_table_1">
						<thead>
							<tr class="f1">
			                  <th style="width:40px"><input id="agentTypeDiv4CheckAll" type="checkbox"></th>
			               	  <th style="width:90px">网点代码</th>
			                  <th style="width:110px">网点名称</th>
			                  <th style="width:90px">用户名</th>
			                  <th style="width:90px">姓名</th>
			                  <th style="width:90px">区域代码</th>
			                  <th style="width:90px">出单机构</th>
			                  <th style="width:90px">服务代码</th>
			                  <th style="width:90px">业务员代码</th>
			                  <th style="width:90px">单证领用人 </th>
			                  <th style="width:100px">团队代码 </th>
			                  <th style="width:100px">归属渠道</th>
					          <th style="width:100px">渠道类型</th>
					          <th style="width:100px">新业务来源</th>
					          <th style="width:100px">原业务来源</th>
			                  <th style="width:90px">代理人编码</th>
			                  <th style="width:90px">代理协议号</th>
			                  <th style="width:90px">手续费比例 </th>
			                  <th style="width:100px">市场维护费比例</th>
			                  <th style="width:90px">业务绩效比例</th>
			              	</tr>
						</thead>
						<tbody>
						</tbody>
					</table>
					<div id="agentTypeDiv4Page"  class="page"></div>
				</td>
			</tr>
		</table>
		<div align="center" >
		  <input type="button" id="saveRoleBtn" value="保存" onclick="saveChooseNocarAgentType4()" class="input_button_3"/>&nbsp;&nbsp;&nbsp;
		  <input type="button" value="取消" onclick="closeNocarAgentTypeDiv('agentTypeDiv4')" class="input_button_3" id="cancelBtn"/>
		</div>
	</div>
	
	<!--广东分公司配置销售人员信息div-->
  	<div id="sale_div" style="display:none;width:1000px; height:450px;">
		<div class="table_title_div" style="width: 990px">
			<table class="table_title" style='width:990px;height: 20px;'>
				<tr>
				<td width="120px"></td>
				<td width="1460px" id="interfaceName"></td>
				<td width="60px" align="right"><img src="./images/closedown.gif" alt="关闭"  onclick="closeNocarAgentTypeDiv('sale_div')"/></td>
				</tr>
			</table>
		</div>
		<table class="table_02" id="table" style="width:990px;" align="center">
			<tr>
				<td>
					<table id="sale3"  class="content_table_1">
						<thead>
							<tr class="f1">
			               	  <th style="width:90px">序号</th>
			                  <th style="width:110px">销售员类型<span style="margin-left: -5px" class="red">*</span></th>
			                  <th style="width:90px">费用比例<span style="margin-left: -5px" class="red">*</span></th>
			                  <th style="width:90px">执业证号</th>
			                  <th style="width:90px">人员类别<span style="margin-left: -5px" class="red">*</span></th>
			                  <th style="width:90px">销售员</th>
			                  <th style="width:90px">业务员<span style="margin-left: -5px" class="red">*</span></th>
			                  <th style="width:90px">代理人编号</th>
			              	</tr>
						</thead>
						<tbody id='salecontent'>
						</tbody>
					</table>
				</td>
			</tr>
		</table>
		<div align="center" >
		  <input type="button" id="saveSaleBtn" value="保存" onclick="saveSale()" class="input_button_3"/>&nbsp;&nbsp;&nbsp;
		  <input type="button" value="取消" onclick="closeNocarAgentTypeDiv('sale_div')" class="input_button_3"/>
		</div>
	</div>
	<!--接口传入方案-->
   	<div id="agentInfo6Div" style="display:none;width:800px; height:350px; ">
		<div class="table_title_div" >
			<table class="table_title" style='height: 20px;'>
				<tr>
				<td width="120px"></td>
				<td width="1460px" id="interfaceName"></td>
				<td align="right"><img src="./images/closedown.gif" alt="关闭"  onclick="closeAgentInfoDiv('agentInfo6Div')"/></td>
				</tr>
			</table>
		</div>
		<div class="table_title_div" style="height:300px; overflow:scroll;">
		<table class="table_02"  align="center">
			<tr>
				<td>
					<table class="search_table">
						<tr height="30px">
							<td colspan="10" style="text-align:center">
							 	跟单配置代码：<input id="agentNoSer" class="input_text" />&nbsp;&nbsp;
								跟单配置名称：<input id="agentNameSer" class="input_text" />&nbsp;&nbsp;
								<input type="button"  class="input_button_1" value="查询" onClick="queryAgentInfo6(1)"/>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<table id="agentInfo6Table"  class="content_table_1" style=' overflow:scroll;'>
						<thead>
							<tr class="f1">
			                  <th >选择</th>
			                  <th >跟单配置代码</th>
			                  <th>跟单配置名称</th>
			              	</tr>
						</thead>
						<tbody>
						</tbody>
					</table>
					<div id="agentInfo6Page"  class="page"></div>
				</td>
			</tr>
		</table>
		</div>
		<div align="center" >
		  <input type="button" value="保存" onclick="saveChosenAgentInfo6()" class="input_button_3"/>&nbsp;&nbsp;&nbsp;
		  <input type="button" value="取消" onclick="closeAgentInfoDiv('agentInfo6Div')" class="input_button_3"/>
		</div>
	</div>
	<!-- 接口传入方案 -->
	<input type="hidden" id='isThirdPlan'>

<div id="unionMessageConfigDiv" style="display:none;width:80%;">
	<div class="table_title_div">
		<table class="table_title" style='width:100%;height:20px;'>
			<tr>
				<td width="10%"></td>
				<td width="80%" id="interfaceName"></td>
				<td width="10%" align="right"><img src="./images/closedown.gif" alt="关闭"
												   onclick="closeUnionMessageConfigDiv(),selectUnionMessageConfigAndWriteBack()"/>
				</td>
			</tr>
		</table>
	</div>
	<table class="table_02" align="center">
		<tr>
			<td>
				<table class="search_table">
					<tr height="30px">
						<td style="border:0px;text-align: left;" id="unionMessageConfigPlanNoTitle">方案号：</td>
						<td style="border:0px;text-align: left;" id="unionMessageConfigPlanNo"></td>
						<td style="border:0px;text-align: left;" id="unionMessageConfigPlanNameTitle">方案名称：</td>
						<td style="border:0px;text-align: left;" id="unionMessageConfigPlanName"></td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td>适用机构：
				<select id="unionMessageConfigDept" style="margin-right: 5%"
						onchange="selectUnionMessageConfigAndWriteBack()">
					<c:if test="${not empty provenceDeptList}">
						<c:forEach items="${provenceDeptList}" var="provenceDept">
							<option value="${provenceDept.deptCode}">${provenceDept.deptCname}</option>
						</c:forEach>
					</c:if>
				</select>
				适用车辆座位数：
				<input id="unionMessageConfigMinSeatNum" onkeyup="clearNoNum(event,this)">
				至
				<input id="unionMessageConfigMaxSeatNum" onkeyup="clearNoNum(event,this)" style="margin-right:5%">

				方案性质：
				<select id="unionMessageConfigPlanType" onchange="selectUnionMessageConfigAndWriteBack()">
					<!-- 1意外 2健康 3财产 4责任 -->
					<option value='1'>意外险</option>
					<option value='2'>健康险</option>
					<option value='3'>财产险</option>
					<option value='4'>责任险</option>
				</select>
			</td>
		</tr>
		<tr>

			<td style="text-align: left">
				&nbsp;&nbsp;适用车辆性质：
			</td>
		</tr>
		<tr>
			<td>
				<c:if test="${not empty carNatureList}">
					<c:forEach items="${carNatureList}" var="carNature">
						<input style="margin-left: 5px" type="checkbox" name="carNatureSelector" id="carNatureSelector"
							   value="${carNature.code}" title="${carNature.code}"> ${carNature.codeName}
					</c:forEach>
				</c:if>
			</td>
		</tr>
		<tr>
			<td style="text-align: left">
				&nbsp;&nbsp;服务代码：
				<input type="text" name="carNlifeServiceCode" id="carNlifeServiceCode" style="width: 500px">
			</td>
		</tr>
		<tr>
			<td><input type="button" onclick='saveUnionMessageConfig()' value="确定"/>&nbsp&nbsp<input type="button"
																									 onclick="closeUnionMessageConfigDiv()"
																									 value="取消"></td>
		</tr>
	</table>
</div>

</body>
</html>